1
我正在使用Greasemonkey每隔100秒在頁面上單擊一個按鈕。到目前爲止,我能夠讓JS點擊按鈕,但它並沒有等待100秒。Greasemonkey腳本中的時間間隔不等待
我沒有收到任何錯誤,但setInterval
只是沒有等待繼續前進。謝謝!
代碼:
console.log('script start');
var int =self.setInterval(function(){clickConfirmButton(e)},100000);
console.log('script start waiting');
function clickConfirmButton(e) {
var buttons = document.getElementsByTagName('button');
var clicked = false;
for (var index=0; index < buttons.length; index++){
if(buttons[index].textContent == "check"){
buttons[index].click();
clicked = true;
break;
}
}
if(!clicked){
setTimeout("window.location.reload()",300*1000);
}
}
clickConfirmButton();
工作!謝謝! – AAA 2013-04-23 12:37:10
不客氣! – 2013-04-23 12:41:53