简体   繁体   English

puppeteer 出错后关闭页面

[英]The puppeteer closes the page after an error

While testing my page, an error is thrown from the dependency.在测试我的页面时,依赖项会引发错误。 The error is not critical and does not interfere with my application.该错误并不严重,不会干扰我的应用程序。 But when testing with a puppeteer, with this error, he simply closes the tested page.但是当使用 puppeteer 进行测试时,出现此错误,他只是关闭了测试页面。 How can I prevent this to continue testing further ignoring this error?如何防止这种情况继续测试而忽略此错误?

Example:例子:
This error is thrown on the page and the test ends with it.该错误在页面上抛出,测试以它结束。

Error: TypeError: Cannot set property 'paddingLeft' of undefined
    at FrozenColumns.layoutRow (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:16595:26)
    at Row.initialize (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:5313:37)
    at Row.reinitialize (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:5376:8)
    at eval (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:4415:7)
    at Array.forEach (<anonymous>)
    at RowManager.reinitialize (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:4414:12)
    at ColumnManager.redraw (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:1206:25)
    at RowManager.refreshActiveData (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:3668:31)
    at RowManager.sorterRefresh (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:3482:8)
    at HTMLDivElement.eval (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:22644:27)

My environment:我的环境:

Puppeteer version: 5.4.2木偶版:5.4.2
Platform / OS version: macOS 10.15.7平台/操作系统版本:macOS 10.15.7
Node.js version: v12.16.1 Node.js版本:v12.16.1

When using jest-puppeteer, you can specify the exitOnPageError: false parameter in jest-puppeteer.config.js.使用 jest-puppeteer 时,可以在 jest-puppeteer.config.js 中指定 exitOnPageError: false 参数。 In this case, the test will not complete if there is an error on the page.在这种情况下,如果页面出现错误,测试将无法完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM