Javascript Casperjs:如何以x秒为间隔评估页面?
我想加载一个页面,然后每隔x秒对其进行多次评估。以下是我尝试过的两种方法: 首先使用JS setInterval: casper.on'remote.message',functionmsg{ this.echo'捕获的远程消息:'+msg; }; casper.thenEvaluatefunction{ 窗口x=0; var intervalID=setIntervalfunction{ console.logiter+window.x; if++window.x==5{ window.clearIntervalidIntervalid; } }, 10000; }; casper.eachlist,functionself,i{ self.wait10000、函数{ last=i; this.echo'Using this.wait'+i; }; }; casper.waitForfunction{ 返回last==list[list.length-1]&&5==this.getGlobal'x'; },功能{ 这个。回显“全部完成”。退出; }; casper.runfunction{}; 第二,使用CasperJS等待: 卡斯珀·斯泰林克,功能{ fori=1;iJavascript Casperjs:如何以x秒为间隔评估页面?,javascript,phantomjs,setinterval,wait,casperjs,Javascript,Phantomjs,Setinterval,Wait,Casperjs,我想加载一个页面,然后每隔x秒对其进行多次评估。以下是我尝试过的两种方法: 首先使用JS setInterval: casper.on'remote.message',functionmsg{ this.echo'捕获的远程消息:'+msg; }; casper.thenEvaluatefunction{ 窗口x=0; var intervalID=setIntervalfunction{ console.logiter+window.x; if++window.x==5{ window.cle