BrowserEvent enum
All the events a browser instance may emit.
Signature
export declare const enum BrowserEvent
Enumeration Members
|
Member |
Value |
Description |
|---|---|---|
|
Console |
|
(Experimental) Emitted when JavaScript within any page or worker in the browser calls one of the console API methods, e.g. Remarks: Use ConsoleMessage.page(), ConsoleMessage.frame() or ConsoleMessage.worker() to identify the originating context. Messages from workers have no page or frame: use ConsoleMessage.worker() for them. Messages logged by the browser itself (e.g. network errors or violations) can have no page, frame or worker. Events are only delivered for pages and workers that Puppeteer has attached to, e.g. via Browser.pages() or Target.page(). Registering the listener before attaching guarantees that console messages replayed by the browser on attachment are not lost. With WebDriver BiDi, console messages that the browser replays while connecting are delivered once, right after Puppeteer.connect() resolves: register the listener before awaiting anything else, or they are missed. Replayed messages can be delivered after messages logged later. Service workers and shared workers are not attached automatically: their console messages are only delivered after Target.worker() has been called for their target. With WebDriver BiDi, their console messages are not reported. The arguments are shared with listeners registered on Page, WebWorker and BrowserContext. Disposing them in one listener invalidates them for all other listeners. |
|
Disconnected |
|
Emitted when Puppeteer gets disconnected from the browser instance. This might happen because either:
|
|
Request |
|
(Experimental) Emitted when any page in the browser issues a request. Contains a HTTPRequest instance. Remarks: Use HTTPRequest.page() or HTTPRequest.frame() to identify the originating context. Requests from dedicated workers have no page or frame: use HTTPRequest.worker() for them. Dedicated worker requests and HTTPRequest.worker() are not supported with WebDriver BiDi. With CDP, events are only delivered for pages that have a Page instance, e.g. created via Browser.pages() or Target.page(). Requests issued before the instance exists, such as the initial navigation of a popup, are not reported. With WebDriver BiDi, requests from all pages are reported. Requests from service workers and shared workers are not reported. These listeners only observe requests. Do not call |
|
RequestFailed |
|
(Experimental) Emitted when a request issued by any page in the browser fails, for example by timing out. Contains a HTTPRequest instance. Remarks: HTTP error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so the request completes with BrowserEvent.RequestFinished and not with BrowserEvent.RequestFailed. The same delivery rules as for BrowserEvent.Request apply. |
|
RequestFinished |
|
(Experimental) Emitted when a request issued by any page in the browser finishes successfully. Contains a HTTPRequest instance. Remarks: The same delivery rules as for BrowserEvent.Request apply. |
|
RequestServedFromCache |
|
(Experimental) Emitted when a request issued by any page in the browser is served from the memory cache. Contains a HTTPRequest instance. Remarks: The same delivery rules as for BrowserEvent.Request apply. |
|
Response |
|
(Experimental) Emitted when a response is received for a request issued by any page in the browser. Contains a HTTPResponse instance. Remarks: Use HTTPResponse.request() to access the originating request. The same delivery rules as for BrowserEvent.Request apply. |
|
TargetChanged |
|
Emitted when the URL of a target changes. Contains a Target instance. Remarks: Note that this includes target changes in all browser contexts. |
|
TargetCreated |
|
Emitted when a target is created, for example when a new page is opened by window.open or by browser.newPage Contains a Target instance. Remarks: Note that this includes target creations in all browser contexts. |
|
TargetDestroyed |
|
Emitted when a target is destroyed, for example when a page is closed. Contains a Target instance. Remarks: Note that this includes target destructions in all browser contexts. |