I'm trying to convert a nodeList into an array and return it from the evaluate() function but get NULL instead of an array. What I'm doing wrong?
casper.wait(5000, function() {
test.assertExists('ul.jobs-search-results__list', "Element is found"); //this test is OK
var listItems = this.evaluate(function() {
var nodes = document.getElementsByClassName('jobs-search-results__list').childNodes;
nodes = Array.prototype.slice.call(nodes);
return nodes;
});
console.log('listItems: ' + listItems); //null returned
});