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');
});
}
});
我這麼想嗎?