0
我试图在while循环中嵌套casper.then()动作。但是,似乎脚本从不执行casper.then()函数内部的代码。在循环中嵌套casper.js动作
这里是我的代码
casper.then(function() {
while (this.exists(x('//a[text()="Page suivante"]'))) {
this.then(function() {
this.click(x('//a[text()="Page suivante"]'))
});
this.then(function() {
infos = this.evaluate(getInfos);
});
this.then(function() {
infos.map(printFile);
fs.write(myfile, "\n", 'a');
});
}
});
我这么想吗?