I've been using PhantomCSS to write visual regression tests with screenshots for a website. I want to simulate a click with CasperJS on every a
element on a page. I am able to retrieve every href and use open
to visit each link, but I want to simulate a click
event to have JavaScript interactions, etc. For some reason I haven't been able to find a way to do this.
I can get all the links on a page with:
links = casper.evaluate(function(){
var tags = __utils__.findAll('a');
return Array.prototype.map.call(tags, function(elem){
return elem.href;
});
});
But casper.click()
receives a selector as a parameter, and I have very generic links across this site. Seems like a pretty trivial task but for some reason I haven't found a way to do it.