PageDomain

Actions and events related to the inspected page belong to the page domain.

Official doc

Functions

Link copied to clipboard

Seeds compilation cache for given url. Compilation cache does not survive cross-process navigation.

Link copied to clipboard

Deprecated, please use addScriptToEvaluateOnNewDocument instead.

Link copied to clipboard

Evaluates given script in every frame upon creation (before loading frame's scripts).

Link copied to clipboard

Fired for failed bfcache history navigations if BackForwardCache feature is enabled. Do not assume any ordering with the Page.frameNavigated event. This event is fired only for main-frame history navigation where the document changes (non-same-document navigations), when bfcache navigation fails.

Link copied to clipboard

Brings page to front (activates tab).

Link copied to clipboard
Link copied to clipboard
suspend fun PageDomain.captureScreenshotToFile(outputImagePath: Path, options: CaptureScreenshotRequest.Builder.() -> Unit = {})

Captures a screenshot of the current page based on the given options, and stores the resulting image into a new file at the given outputImagePath. If the file already exists, it is overwritten.

Link copied to clipboard

Returns a snapshot of the page as a string. For MHTML format, the serialization includes iframes, shadow DOM, external resources, and element-inline styles.

Link copied to clipboard

Clears seeded compilation cache.

Link copied to clipboard

Clears the overridden device metrics.

Link copied to clipboard

Clears the overridden Device Orientation.

Link copied to clipboard

Clears the overridden Geolocation Position and Error.

Link copied to clipboard
suspend fun close(): CloseResponse

Tries to close page, running its beforeunload hooks, if any.

Link copied to clipboard

Issued for every compilation cache generated. Is only available if Page.setGenerateCompilationCache is enabled.

Link copied to clipboard
suspend fun crash(): CrashResponse

Crashes renderer on the IO thread, generates minidumps.

Link copied to clipboard

Creates an isolated world for the given frame.

Link copied to clipboard
suspend fun deleteCookie(cookieName: String, url: String): DeleteCookieResponse

Deletes browser cookie with given name, domain and path.

Link copied to clipboard
suspend fun disable(): DisableResponse

Disables page domain notifications.

Link copied to clipboard
Link copied to clipboard

Fired when opening document to write to.

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
Link copied to clipboard

Fired when download makes progress. Last call has |done| == true. Deprecated. Use Browser.downloadProgress instead.

Link copied to clipboard
Link copied to clipboard

Fired when page is about to start a download. Deprecated. Use Browser.downloadWillBegin instead.

Link copied to clipboard
suspend fun enable(): EnableResponse

Enables page domain notifications.

Link copied to clipboard
fun events(): Flow<PageEvent>

Subscribes to all events related to this domain.

Link copied to clipboard
Link copied to clipboard

Emitted only when page.interceptFileChooser is enabled.

Link copied to clipboard
Link copied to clipboard

Fired when frame has been attached to its parent.

Link copied to clipboard

Fired when frame no longer has a scheduled navigation.

Link copied to clipboard
Link copied to clipboard

Fired when frame has been detached from its parent.

Link copied to clipboard
Link copied to clipboard

Fired once navigation of the frame has completed. Frame is now associated with the new loader.

Link copied to clipboard

Fired when a renderer-initiated navigation is requested. Navigation may still be cancelled after the event is issued.

Link copied to clipboard
Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard

Fired when frame schedules a potential navigation.

Link copied to clipboard

Fired when frame has started loading.

Link copied to clipboard

Fired when frame has stopped loading.

Link copied to clipboard

Generates a report for testing.

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
suspend fun getAppId(): GetAppIdResponse

Returns the unique (PWA) app id. Only returns values if the feature flag 'WebAppEnableManifestId' is enabled

Link copied to clipboard

Gets the processed manifest for this current document. This API always waits for the manifest to be loaded. If manifestId is provided, and it does not match the manifest of the current document, this API errors out. If there is not a loaded page, this API errors out immediately.

Link copied to clipboard

Returns present frame tree structure.

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard

Returns metrics relating to the layouting of the page, such as viewport bounds/scale.

Link copied to clipboard

Deprecated because it's not guaranteed that the returned icon is in fact the one used for PWA installation.

Link copied to clipboard

Returns navigation history for the current page.

Link copied to clipboard

Get Origin Trials on given frame.

Link copied to clipboard
Link copied to clipboard

Returns content of the given resource.

Link copied to clipboard

Returns present frame / resource tree structure.

Link copied to clipboard

Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).

Link copied to clipboard

Fired when interstitial page was hidden

Link copied to clipboard
Link copied to clipboard

Fired when interstitial page was shown

Link copied to clipboard

Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed.

Link copied to clipboard

Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.

Link copied to clipboard
Link copied to clipboard

Fired for top level page lifecycle events such as navigation, load, paint, etc.

Link copied to clipboard
Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
inline suspend fun navigate(url: String, optionalArgs: NavigateRequest.Builder.() -> Unit = {}): NavigateResponse

Navigates current page to the given URL.

Link copied to clipboard

Fired when same-document navigation happens, e.g. due to history API usage or anchor navigation.

Link copied to clipboard

Navigates current page to the given history entry.

Link copied to clipboard
inline suspend fun printToPDF(optionalArgs: PrintToPDFRequest.Builder.() -> Unit = {}): PrintToPDFResponse

Print page as PDF.

Link copied to clipboard

Requests backend to produce compilation cache for the specified scripts. scripts are appended to the list of scripts for which the cache would be produced. The list may be reset during page navigation. When script with a matching URL is encountered, the cache is optionally produced upon backend discretion, based on internal heuristics. See also: Page.compilationCacheProduced.

Link copied to clipboard
inline suspend fun reload(optionalArgs: ReloadRequest.Builder.() -> Unit = {}): ReloadResponse
suspend fun reload(input: ReloadRequest): ReloadResponse

Reloads given page optionally ignoring the cache.

Link copied to clipboard
Link copied to clipboard

Resets navigation history for the current page.

Link copied to clipboard
Link copied to clipboard

Acknowledges that a screencast frame has been received by the frontend.

Link copied to clipboard

Compressed image data requested by the startScreencast.

Link copied to clipboard

Fired when the page with currently enabled screencast was shown or hidden `.

Link copied to clipboard
inline suspend fun searchInResource(frameId: FrameId, url: String, query: String, optionalArgs: SearchInResourceRequest.Builder.() -> Unit = {}): SearchInResourceResponse

Searches for given string in resource content.

Link copied to clipboard

Enable Chrome's experimental ad filter on all sites.

Link copied to clipboard

Enable page Content Security Policy by-passing.

Link copied to clipboard
inline suspend fun setDeviceMetricsOverride(width: Int, height: Int, deviceScaleFactor: Double, mobile: Boolean, optionalArgs: SetDeviceMetricsOverrideRequest.Builder.() -> Unit = {}): SetDeviceMetricsOverrideResponse

Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results).

Link copied to clipboard

Sets given markup as the document's HTML.

Link copied to clipboard

Set the behavior when downloading a file.

Link copied to clipboard
inline suspend fun setFontFamilies(fontFamilies: FontFamilies, optionalArgs: SetFontFamiliesRequest.Builder.() -> Unit = {}): SetFontFamiliesResponse

Set generic font families.

Link copied to clipboard

Set default font sizes.

Link copied to clipboard

Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.

Link copied to clipboard

Intercept file chooser requests and transfer control to protocol clients. When file chooser interception is enabled, native file chooser dialog is not shown. Instead, a protocol event Page.fileChooserOpened is emitted.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions for Custom Handlers API: https://html.spec.whatwg.org/multipage/system-state.html#rph-automation

Link copied to clipboard

Sets the Secure Payment Confirmation transaction mode. https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode

Link copied to clipboard
Link copied to clipboard

Tries to update the web lifecycle state of the page. It will transition the page to the given state according to: https://github.com/WICG/web-lifecycle/

Link copied to clipboard

Starts sending each frame using the screencastFrame event.

Link copied to clipboard

Force the page stop all navigations and pending resource fetches.

Link copied to clipboard

Stops sending each frame in the screencastFrame.

Link copied to clipboard

Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.

Link copied to clipboard
Link copied to clipboard

Fired when a new window is going to be opened, via window.open(), link click, form submission, etc.