javascript - Node.js puppeteer - 如何设置导航超时?
问题描述
我正在使用 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'});
解决方案
timeout: 0
如果您正在加载一个沉重的页面,您可以使用来禁用超时错误。
以你page.goto
喜欢的方式使用它:
await page.goto('url'+tableCell04Val, {waitUntil: 'load', timeout: 0});
推荐阅读
- typescript - 元组元素的打字稿类型预测
- android - 如何从 Android 应用程序设置 Google SIP 的 SHIFT 状态
- python - 使用 Python xlswriter 将自定义字符串标签添加到 Excel 散点图
- javascript - JEST 全局变量未按预期更新
- java - Java 在类路径中看不到 JAR 文件
- html - 如何添加 AngularJS DHTML 指令?
- amazon-web-services - 在 s3 的上下文中,非双栈是什么意思?
- regex - 尖括号内的正则表达式换行匹配
- javascript - 如何在类的所有实例中运行相同的方法?
- php - 需要没有 html 内容的 php 文件