Intern's pollUntil does not work with Chrome

137 views Asked by At

I have a custom crawler that redirects to all pages in an application and takes screenshot. The page load works perfectly fine in Firefox. However in Chrome, the page does not load properly and as a result most of the screenshots come as blank.

return remote.get(newAddress)
    .then(pollUntil('return document.readyState==="complete";', [], 30000))
    .takeScreenshot().then(function(data) {
        recordImage(newAddress, data);
    })
1

There are 1 answers

0
C Snover On BEST ANSWER

false is considered a value by pollUntil. You need to return null or undefined if you want it to continue polling:

return remote.get(newAddress)
    .then(pollUntil('return document.readyState==="complete"||null;', [], 30000))
    .takeScreenshot().then(function(data) {
        recordImage(newAddress, data);
    })

From the docs:

The function should return null or undefined if there is not a result. If the poller function throws, polling will halt.