This only refreshes the page once, I have tested it. How do I make it reload the page every 5 seconds and look for an element then click on it?
function reload() {
document.location.reload();
}
setTimeout(reload, 5000);
This only refreshes the page once, I have tested it. How do I make it reload the page every 5 seconds and look for an element then click on it?
function reload() {
document.location.reload();
}
setTimeout(reload, 5000);
Hopefully this is what you're looking for.
setTimeout(() => {
const button = document.querySelector('.button');
button.dispatchEvent(new MouseEvent('click'));
window.location.reload();
}, 5000)