Help? Code issue....
You can simply use setTimeout
:
setTimeout(() => {
document.getElementsByClassName("ui-arrow-right")[0].click();
}, 31000);
Or detect the exact moment with MutationObserver
:
const arrows = document.getElementsByClassName('ui-arrow-right');
new MutationObserver((mutations, observer) => {
const arrow = arrows[0];
if (arrow) {
observer.disconnect();
arrow.click();
}
}).observe(document, {subtree: true, childList: true});
I'm using getElementsByClassName here instead of checking every mutation
because it's a super-fast live collection that gets updated whenever we access it.
Help? Code issue....
Basically I want to be able to go through the slideshows automatically....
I have it wait for 31 seconds after page load (timer per page is 30 seconds)
and then click the NEXT when it pops up
This is the class I look for when I go to click: (ui-arrow-right)
Heres the code I did:
What did I do wrong?
Also, is there a way to make it wait till it see's the "Next" button then click it? instead of Page load and THEN wait 31 seconds?