我正在使用 node.js 和 puppeteer 来获取一些数据。我打开的一些文件非常大……然后我得到一个错误:
错误:
our error { TimeoutError: Navigation Timeout Exceeded: 30000ms exceeded
at Promise.then (/project/node_modules/puppeteer/lib/NavigatorWatcher.js:74:21)
at <anonymous> name: 'TimeoutError' }
我怎样才能忽略它或设置更高的超时时间?
那是我的脚本:
await page.goto('url'+tableCell04Val, {waitUntil: 'load'});
原文由 Philipp M 发布,翻译遵循 CC BY-SA 4.0 许可协议
如果您正在加载繁重的页面,您可以使用
timeout: 0
来禁用超时错误。在您的
page.goto
中使用它,例如:您可以在此处查看对 Pupeteer 所做的 PR,其中添加了更改,以及实现它的文档和单元测试。