Please forgive me if this has already been answered somewhere but I just can't find what I'm looking for. I'm using Greasemonkey for Firefox and Tampermonkey in Chrome to try to create a Javascipt to change how I interact with a webpage. Upon page load, I'd like to automatically open a link in a new tab in the background. This link is slightly different each time I load the page. The element from the webpage is this:
<a href="/cgi/admin/user/ssh_login/*" target="_blank">SSH</a>
The part with the * is what's different each time.
So how can I automatically click that link upon page load if it doesn't have an elementID or at the very least an elementName?
If the content of the
anchor
is always going to be 'SSH' you can use;$("a:contains('SSH')")
Edit:
Open link in a background tab in chrome (based on this answer)