Closed ruxiang05 closed 7 years ago
Use CasperJS's waitFor methods such as http://docs.casperjs.org/en/latest/modules/casper.html#waitforselector
var selector = '.carousel-control-left';
casper.waitForSelector(selector , function() {
phantomcss.screenshot(selector , 'carousel-control-left');
});
It would also be worth checking that your code isn't throwing errors (maybe because you are using a feature of JavaScript that is not supported by PhantomJS) http://docs.casperjs.org/en/latest/events-filters.html
casper.on("page.error", function(msg, trace) {
casper.echo("Error: " + msg, "ERROR");
});
I am having a carousel with two left/right control buttons on the side. However, when I run the test they don't appear. I believe this is because the javascript hasn't run on the page. Is there any way I can test after the js run?