Skip to content

WebError ​

Added in: v1.38

WebError class represents an unhandled exception thrown in the page. It is dispatched via the browserContext.on("webError") event.

python
# 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>")
python
# 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>")

Methods ​

web_error.error() ​

Added in: v1.38

Unhandled error that was thrown.

Returns

  • Error

web_error.location() ​

Added in: v1.60

Returns

  • Object

web_error.page() ​

Added in: v1.38

The page that produced this unhandled exception, if any.

Returns

  • null | Page

Released under the Apache 2.0 License.