I'm using this javascript code:
document.getElementsByName("commit")[0].click();
to perform a click on a button, the problem is that when I send the command sometimes the page is't loaded , so it can't be clicked . So how i can perform the click until it actually happens ? i have tried something like this:
if (document.readyState === 'complete') { //don't work
document.getElementsByName("commit")[0].click();
}
but it doesn't work. (I can't use jquery, cause I'm on a chrome extension)