跳到主要內容

WebError

WebError 類別代表頁面中未處理的例外狀況。它是透過 BrowserContext.onWebError(handler) 事件發送。

// Log all uncaught errors to the terminal
context.onWebError(webError -> {
System.out.println("Uncaught exception: " + webError.error());
});

// Navigate to a page with an exception.
page.navigate("data:text/html,<script>throw new Error('Test')</script>");

方法

error

新增於:v1.38 webError.error

拋出的未處理錯誤。

用法

WebError.error();

回傳


page

新增於:v1.38 webError.page

產生此未處理例外狀況的頁面(如果有的話)。

用法

WebError.page();

回傳