-1

Suppose, a website having a button and I want that, it automatically clicked every hour and reset the timer to be performed in the next hour same operation on the same button, in the website the button is given in input tag using the id_name I've to operate using javascript. Using https://www.tampermonkey.net/ to perform operation on website using js. I've googled but nothing was found helpful or not working.

setInterval(function () {document.getElementById("mark_attendance").click();}, 3600000);

I've used this code works fine in localhost, in the website it's not working.

Toto
  • 89,455
  • 62
  • 89
  • 125
  • 1
    It depends what kind of button is that you want to click. Some frameworks work on 'mousedown' event or something similar. Try from the console and devtools to find a way to click on that button. Once you find it its easy to add in interval. Remember that some browsers also put loop scripts on pause once the tab leave focus. – Eugene May 23 '21 at 08:22

1 Answers1

-1

When your button is clicked you can call a function then recall it every hour

<button onclick="clickFunction()">Button to click</button>
<script>
  setInterval(clickFunction, 3600000)
  function clickFunction() {
    console.log("Button clicked!")
  }
</script>
hi12167pies
  • 175
  • 1
  • 1
  • 9