node.js - requestfailed.failure() 为阻止的混合内容错误给出 null
问题描述
对于块内容事件,会触发“请求失败”事件。但是对于这个特定事件, requestfailed.failure() 给出的是空值而不是错误文本。有没有人有解决方法?
重现步骤:
使用 puppeteer,导航到有任何混合内容错误的页面。例如 https://books.toscrape.com/catalogue/category/books/add-a-comment_18/index.html
我有以下监听器用于监听请求失败事件
page.on('requestfailed', requestfailed => { var req=JSON.stringify(requestfailed.failure()) console.log('requestfailed occurred: ', req); })
对于上面的 URL,它的返回值为 null
环境:
Puppeteer version:^5.5.0
Platform / OS version: Windows 7
Node.js version:v12.18.4
PS:在 github https://github.com/puppeteer/puppeteer/issues/7036上为 puppeteer 社区创建了一张票
解决方案
推荐阅读
- javascript - 对文本元素进行条件操作?
- docker - 不需要的升级 ElasticSearch 版本
- javascript - 为什么我的 Ajax 请求不能使用 post 方法?
- python - 追加 csv 的列值
- android - Android webView - 无法加载某些链接 - 收到无效流的 RST
- fp-ts - 使用 FP-TS 消耗 IO
- serial-port - RS-232 波特率和线长对接收的串行位的影响
- android - OkHttp connectTimeout 细节
- python - Keras耗时太长,不知道我用的是GPU还是CPU
- javascript - es6 继承多个类