When phantom
is used as node
module, the function WaitFor that waits for a DOM element condition to be verified does not work when page.evaluate
is a Promise
like:
sitepage.evaluate(function() {
return document.querySelectorAll('.content > ul');
}).then(function(html) {
sitepage.close();
phInstance.exit();
if (done) done(pageContent);
});
so this will not work:
waitFor(function() {
return sitepage.evaluate(function() {
return document.querySelectorAll('.content > ul');
}).then(function(html) {
sitepage.close();
phInstance.exit();
if (done) done(pageContent);
});
},
function() {
sitepage.close();
phInstance.exit();
}, 1000);
In this case the then
holds the results from the evaluate
condition. So it possible to implement in the waitFor
support for the Promise
?