I need to open all the search results of each link new tab automatically. I have tried below script which I have found from here. I am unable to achieve the expected outcome. I am absolute new to scripting and help me fix or guide me through achieve the outcome.
// ==UserScript==
// @name AutoClicker
// @match https://www.google.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @grant GM_openInTab
// ==/UserScript==
var TargetLink = $("a:contains('example')");
if (TargetLink.length)
GM_openInTab (TargetLink[0].href);
Error 1

Error 2

Although the question isn't the most recent one, here's a simple solution without any external dependencies:
// ==UserScript==
// @name AutoClicker
// @match https://www.google.com/*
// @grant GM_openInTab
// ==/UserScript==
for (const a of document.querySelectorAll("a")) {
if (a.textContent.includes("example")) {
GM_openInTab(a.href)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With