PageEvent 枚举
🌐 PageEvent enum
页面实例可能触发的所有事件。
🌐 All the events that a page instance may emit.
语法
🌐 Signature
export declare const enum PageEvent
枚举成员
🌐 Enumeration Members
成员 🌐 Member | 值 🌐 Value | 描述 🌐 Description |
|---|---|---|
关闭 🌐 Close |
| 页面关闭时触发。 🌐 Emitted when the page closes. |
Console |
| 当页面中的 JavaScript 调用控制台 API 方法(例如 🌐 Emitted when JavaScript within the page calls one of console API methods, e.g. 附注 一个 🌐 A |
Dialog |
| 当出现 JavaScript 对话框时触发,例如 🌐 Emitted when a JavaScript dialog appears, such as |
DOMContentLoaded |
| 当 JavaScript DOMContentLoaded 事件被分发时触发。 🌐 Emitted when the JavaScript DOMContentLoaded event is dispatched. |
错误 🌐 Error |
| 当页面崩溃时触发。将包含一个 🌐 Emitted when the page crashes. Will contain an |
FrameAttached |
| 当帧被附加时触发。将包含一个 Frame。 🌐 Emitted when a frame is attached. Will contain a Frame. |
FrameDetached |
| 当一个框架被分离时触发。将包含一个 Frame。 🌐 Emitted when a frame is detached. Will contain a Frame. |
FrameNavigated |
| 当帧被导航到新 URL 时触发。将包含一个 Frame。 🌐 Emitted when a frame is navigated to a new URL. Will contain a Frame. |
加载 🌐 Load |
| 当 JavaScript load 事件被分发时触发。 🌐 Emitted when the JavaScript load event is dispatched. |
Metrics |
| 当 JavaScript 代码调用 🌐 Emitted when the JavaScript code makes a call to 附注 包含一个具有两个属性的对象: 🌐 Contains an object with two properties:
|
PageError |
| 当页面内发生未捕获的异常时触发。包含一个 🌐 Emitted when an uncaught exception happens within the page. Contains an |
弹出窗口 🌐 Popup |
| 当页面打开新选项卡或窗口时触发。 🌐 Emitted when the page opens a new tab or window. 包含一个对应于弹出窗口的页面。 🌐 Contains a Page corresponding to the popup window. |
要求 🌐 Request |
| 当页面发出请求且包含 HTTPRequest 时触发。 🌐 Emitted when a page issues a request and contains a HTTPRequest. 附注 该对象是只读的。有关拦截和修改请求,请参阅 Page.setRequestInterception()。 🌐 The object is readonly. See Page.setRequestInterception() for intercepting and mutating requests. |
RequestFailed |
| 当请求失败时触发,例如超时。 🌐 Emitted when a request fails, for example by timing out. 包含一个 HTTPRequest。 🌐 Contains a HTTPRequest. 附注 HTTP 错误响应,例如 404 或 503,从 HTTP 的角度来看仍然是成功的响应,因此请求将以 🌐 HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with |
RequestFinished |
| 当请求成功完成时发出。包含一个 HTTPRequest。 🌐 Emitted when a request finishes successfully. Contains a HTTPRequest. |
RequestServedFromCache |
| 当请求最终从缓存加载时触发。包含一个 HTTPRequest。 🌐 Emitted when a request ended up loading from cache. Contains a HTTPRequest. 附注 对于某些请求,可能包含未定义。https://crbug.com/750469 🌐 For certain requests, might contain undefined. https://crbug.com/750469 |
响应 🌐 Response |
| 当收到响应时发出。包含一个 HTTPResponse。 🌐 Emitted when a response is received. Contains a HTTPResponse. |
WorkerCreated |
| 当页面生成一个专用的 WebWorker 时触发。 🌐 Emitted when a dedicated WebWorker is spawned by the page. |
WorkerDestroyed |
| 当页面销毁专用的 WebWorker 时触发。 🌐 Emitted when a dedicated WebWorker is destroyed by the page. |