For the past two hours, I have been trying to query for DOM elements and store them in an array using CasperJS, so after that I can skip them and fire the click event.
Say my markup looks like this:
<ul> <li>One</li> <li>Two</li> <li>Three</li> </ul>
Now I want to save each <li> Array, then loop, fire the Click event, and then take a capture.
This is one of the things I tried:
var listItems = []; casper.start(); casper.open(urlHere, function () { listItems.push(this.evaluate(function () { return document.querySelectorAll('ul > li'); })); this.echo(listItems); });
It returns [ , , , ] ,,, [ , , , ] , which basically means that they are all null .
Can someone direct me in the right direction?
Thanks!
source share