M
M
maxi2312021-06-19 15:20:33
JavaScript
maxi231, 2021-06-19 15:20:33

How to implement JS script on original tasks?

I have a script that programmatically clicks on a button on the site
So, I have 2 tasks
so that he clicks on it constantly until another window pops up
and so that he clicks on another button after he clicks on the previous one,
how can this be implemented ?

const sleep = (milliseconds) => {
  return new Promise(resolve => setTimeout(resolve, milliseconds))
}
window.onload = async function() {
  var box = document.querySelector('input[data-indeterminate="false"]')
    if (box != null) {
        document.querySelector('input[data-indeterminate="false"]').click();
    }   
    while (document.querySelector('button.btn.btn-primary.btn-block') == null) {await sleep(400);}
    clck_approve = (document.querySelector('button.btn.btn-primary.btn-block')).click();
  }

This code only clicks on the button as soon as you enter the site

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question