so want function run every 24h , execute few steps on website: reason, stops running after first query selector.
what happen is:
run script -> click element -> wait until next page has loaded -> click next element. any appreciated!
window.onload = function(){ settimeout(function() { document.queryselectorall("[href*='0310']")[0].click(); }, 4000); //wait until next page loads settimeout(function() { document.queryselectorall("[href*='0310']")[1].click(); },4000); //wait until next page loads settimeout(function() { document.queryselectorall("[href*='0310']")[1].click(); },4000); //wait until next page loads settimeout(function() { document.queryselectorall("[type='checkbox']")[1].click(); },4000); //wait until next page loads settimeout(function() { document.queryselectorall(".btn-primary")[2].click(); },4000); }; i'm quite lost here...
all settimeout functions run @ same time, 4 seconds after page load. settimeout done asynchronously need change them 4, 8, 12, 16 , 20 seconds.
settimeout(function(){/*first*/}, 4000); settimeout(function(){/*second*/}, 8000); settimeout(function(){/*third*/}, 12000); settimeout(function(){/*fourth*/}, 16000); settimeout(function(){/*fifth*/}, 20000); i've set jsfiddle want.
Comments
Post a Comment