Hi,

it might be related to the timing. The console query is executed after the page is loaded, while the Greasemonkey script is executed before the page is ready. It might be the case that the querySelector-call doesn't actually return any element, because the page isn't finished yet.

To solve the problem, try executing the discovery after the page is ready:

document.addEventListener("load", function() {
  var button = document.querySelector(".Whatever Button");
  setInterval(function(){ button.click(); }, 200));
});

Greetings, Chris

Am 13.07.2018 um 17:11 schrieb Overslam:
Hi Everyone,

I'm trying to run the following script on a webpage via Greasmonkey     var button = document.querySelector(".Whatever Button"); setInterval(function(){ button.click() },200)) .  Basically this script should keep clicking a button on a webpage.

The script works just fine from Mozilla developer console. However, it does nothing on a webpage via Greasmonkey. Please help me to figure out why.

Thank you,


--
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at https://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to