I would like to capture a screenshot on every page. In order to navigate to a different page there is a function moveNext()
. When I check in the console I am able to see that its navigating to all the pages in sequence. However, its not taking screenshot simultaneously at every page instead, it takes multiple screenshots of the last page. Does casperjs offer callback or waiting option?
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);
}
});