1

我有一个自定义爬虫,它重定向到应用程序中的所有页面并截取屏幕截图。页面加载在 Firefox 中运行良好。但是在 Chrome 中,页面无法正确加载,因此大多数屏幕截图都是空白的。

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

1 回答 1

1

false被认为是一个值pollUntil。您需要返回null或者undefined如果您希望它继续轮询:

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

文档

如果没有结果,该函数应返回 null 或 undefined。如果轮询函数抛出,轮询将停止。

于 2015-06-18T15:45:38.023 回答