use*_*794 31 javascript phantomjs casperjs
我在用waitFor()
.代码如下:
casper.waitFor(function check() {
return this.evaluate(function() {
return this.evaluate(someFunction, 'variable 1','variable 2','variable 3') === 'yes';
});
}, function then() {
console.log('Done');
});
Run Code Online (Sandbox Code Playgroud)
我把它作为控制台输出
Wait timeout of 5000ms expired, exiting.
Run Code Online (Sandbox Code Playgroud)
如何增加超时?
编辑:我已将代码更改为
casper.waitFor(function check() {
return this.evaluate(function() {
return this.evaluate(someFunction, 'variable 1','variable 2','variable 3') === 'yes';
});
}, function then() {
console.log('Done');
},10000);
Run Code Online (Sandbox Code Playgroud)
它给了我以下错误:
CasperError: Invalid timeout function, exiting.
C:/filename:1720 in _check
Run Code Online (Sandbox Code Playgroud)
Cyb*_*axs 27
至于说在这里,
签名是
waitFor(Function testFx[, Function then, Function onTimeout, Number timeout])
Run Code Online (Sandbox Code Playgroud)
因此,有一个额外的参数来指定超时.
casper.waitFor(function check() {
//...
});
}, function then() {
//...
}, function timeout() {
//...
}, TIMEOUT_IN_MS);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
25502 次 |
最近记录: |