WebError class represents an unhandled exception thrown in the page. It is dispatched via the BrowserContext.on(:web_error) event.
# Log all uncaught errors to the terminal
BrowserContext.on(context, :web_error, fn web_error ->
IO.puts(~s(Uncaught exception: "#{Exception.message(WebError.error(web_error))}"))
end)
# Navigate to a page with an exception.
Page.goto!(page, ~s{data:text/html,<script>throw new Error("Test")</script>})Since Playwright 1.38.
The examples alias the modules they use (alias Playwright.{Locator, Page}).
Summary
Functions
Unhandled error that was thrown.
Since Playwright 1.60.
The page that produced this unhandled exception, if any.
Types
Functions
@spec error(t()) :: Exception.t()
Unhandled error that was thrown.
Since Playwright 1.38.
Since Playwright 1.60.
@spec page(t()) :: nil | Playwright.Page.t()
The page that produced this unhandled exception, if any.
Since Playwright 1.38.