I am having trouble parsing a page with CasperJS. It seems like the this.evaluate() function only handles the source code. However, the page I am looking at uses jQuery to add classes to specific elements after the document has been fully loaded.
How can I use CasperJS to evaluate the generated source after page is fully loaded / ready.
casper.start(url);
casper.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64) Chrome/30.0.1599.101');
casper.viewport(1920, 20000);
casper.on('load.finished', function(resource) {
this.evaluate(getSelectedItems);
});
casper.run();
.
This is the code that I am currently trying to use within my this.evaluate(getSelectedItems) function. I just want to detect how many selected items there are, but the source code doesn't contain .selected-item. That class is generated after the full page load with jQuery.
function getSelectedItems() {
return document.querySelector('.selected-item').length;
}