WebError class represents an unhandled exception thrown in the page. It is dispatched via the browserContext.on('weberror') event.
// Log all uncaught errors to the terminalcontext.on('weberror', webError => { console.log(`Uncaught exception: "${webError.error()}"`);});// Navigate to a page with an exception.await page.goto('data:text/html,<script>throw new Error("Test")</script>'); Copy
// Log all uncaught errors to the terminalcontext.on('weberror', webError => { console.log(`Uncaught exception: "${webError.error()}"`);});// Navigate to a page with an exception.await page.goto('data:text/html,<script>throw new Error("Test")</script>');
Unhandled error that was thrown.
0-based column number in the resource.
0-based line number in the resource.
URL of the resource.
The page that produced this unhandled exception, if any.
WebError class represents an unhandled exception thrown in the page. It is dispatched via the browserContext.on('weberror') event.