var casper = require('casper').create();
casper.start('http://google.com/', function () {
console.log('URL loaded.');
});
// It does work if I comment the line below.
casper.run();
setInterval(function () {
console.log('setInterval log.');
}, 2000);
如何使 setInterval()方法使用 casper.run()方法?
答案 0 :(得分:1)
将setInterval
作为lambda函数传递:
casper.run(function() {
setInterval(function () {
console.log('setInterval log.');
}, 2000);
});