userscript to click button automatically on refresh
Using Firefox.
I'm curious if there's any possible way to have a script automatically click on a specific submit button every 2-3 seconds for example. This is for backend server administration purpose I need to add a bunch of submissions from a drop down menu. Screenshot attached as an example (full address censored for privacy).
All Replies (3)
You could easily do this using the click()
method within a function that is triggered by a setTimeout()
method in Javascript.
For example, your Javascript file would look similar to this:
function clickButton() { button.click(); setTimeout(clickButton,2000); } // First call clickButton();
That would run infinity. If you want to the function to only run a finite amount of times, you would have to implement a counter variable that would increment each time the function runs.
Naturally, this won't bypass any websites that have a submission time limit to prevent sending X number of requests within a certain period of time and you may run into issues if the website reloads itself after the submit button is clicked, which is usually the default behavior of such a button.
Thanks Wesley. I'm sorry, I never used Userscript or anything. Could you please explain how this would work?
You would need the Greasemonkey addon installed and they have all of the information about using and implementing the program on their wiki.