Source: https://playwright.dev/python/docs/api/class-weberror
Skip to main content
On this page
WebError
class represents an unhandled exception thrown in the page. It is dispatched via the browser_context.on("weberror")
event.
-
Sync
-
Async
Log all uncaught errors to the terminalcontext.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>")
Log all uncaught errors to the terminalcontext.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>")
Properties
error
Added in: v1.38 webError.error
Unhandled error that was thrown.
Usage
web_error.error
Returns
page
Added in: v1.38 webError.page
The page that produced this unhandled exception, if any.
Usage
web_error.page
Returns