English · Python
Appearance
English · Python
Appearance
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 terminal
context.on("weberror", lambda web_error: print(f"uncaught exception: {web_error.error}"))
# Navigate to a page with an exception.
await page.goto("data:text/html,<script>throw new Error('test')</script>")# Log all uncaught errors to the terminal
context.on("weberror", lambda web_error: print(f"uncaught exception: {web_error.error}"))
# Navigate to a page with an exception.
page.goto("data:text/html,<script>throw new Error('test')</script>")Unhandled error that was thrown.
Returns
ErrorReturns
ObjectThe page that produced this unhandled exception, if any.
Returns
null | Page