すべてのページでスクリーンショットをキャプチャしたいと思います。別のページに移動するには、関数がありますmoveNext()
。コンソールを確認すると、すべてのページに順番に移動していることがわかります。ただし、すべてのページで同時にスクリーンショットを撮るのではなく、最後のページの複数のスクリーンショットを撮ります。casperjs はコールバックまたは待機オプションを提供しますか?
casper.then(function () {
for (var currentPage = startPage; currentPage < lastPage; currentPage++) {
this.page.evaluate(function(currentPage) {
moveNext(currentPage);
}, currentPage);
phantomcss.screenshot('html', 'screenshot');
console.log(currentPage);
}
});