NetworkDomain

Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.

Official doc

Functions

Link copied to clipboard

Tells whether clearing browser cache is supported.

Link copied to clipboard

Tells whether clearing browser cookies is supported.

Link copied to clipboard

Tells whether emulation of network conditions is supported.

Link copied to clipboard

Clears accepted encodings set by setAcceptedEncodings

Link copied to clipboard

Clears browser cache.

Link copied to clipboard

Clears browser cookies.

Link copied to clipboard

Response to Network.requestIntercepted which either modifies the request to continue with any modifications, or blocks it, or completes it with the provided response bytes. If a network fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted event will be sent with the same InterceptionId. Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead.

Link copied to clipboard
Link copied to clipboard

Fired when data chunk was received over the network.

Link copied to clipboard
inline suspend fun deleteCookies(name: String, optionalArgs: DeleteCookiesRequest.Builder.() -> Unit = {}): DeleteCookiesResponse

Deletes browser cookies with matching name and url or domain/path pair.

Link copied to clipboard
suspend fun disable(): DisableResponse

Disables network tracking, prevents network events from being sent to the client.

Link copied to clipboard
inline suspend fun emulateNetworkConditions(offline: Boolean, latency: Double, downloadThroughput: Double, uploadThroughput: Double, optionalArgs: EmulateNetworkConditionsRequest.Builder.() -> Unit = {}): EmulateNetworkConditionsResponse

Activates emulation of network conditions.

Link copied to clipboard
inline suspend fun enable(optionalArgs: EnableRequest.Builder.() -> Unit = {}): EnableResponse
suspend fun enable(input: EnableRequest): EnableResponse

Enables network tracking, network events will now be delivered to the client.

Link copied to clipboard

Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client. Enabling triggers 'reportingApiReportAdded' for all existing reports.

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

Subscribes to all events related to this domain.

Link copied to clipboard

Fired when EventSource message is received.

Link copied to clipboard

Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the cookies field. Deprecated. Use Storage.getCookies instead.

Link copied to clipboard

Returns the DER-encoded certificate.

Link copied to clipboard
inline suspend fun getCookies(optionalArgs: GetCookiesRequest.Builder.() -> Unit = {}): GetCookiesResponse

Returns all browser cookies for the current URL. Depending on the backend support, will return detailed cookie information in the cookies field.

Link copied to clipboard

Returns post data sent with the request. Returns an error when no data was sent with the request.

Link copied to clipboard

Returns content served for the given request.

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

Fired when HTTP request has failed to load.

Link copied to clipboard
Link copied to clipboard

Fired when HTTP request has finished loading.

Link copied to clipboard

Fetches the resource and returns the content.

Link copied to clipboard
suspend fun replayXHR(requestId: RequestId): ReplayXHRResponse

This method sends a new XMLHttpRequest which is identical to the original one. The following parameters should be identical: method, url, async, request body, extra headers, withCredentials attribute, user, password.

Link copied to clipboard

Is sent whenever a new report is added. And after 'enableReportingApi' for all existing reports.

Link copied to clipboard

Details of an intercepted HTTP request, which must be either allowed, blocked, modified or mocked. Deprecated, use Fetch.requestPaused instead.

Link copied to clipboard

Fired if request ended up loading from cache.

Link copied to clipboard

Fired when page is about to send HTTP request.

Link copied to clipboard

Fired when additional information about a requestWillBeSent event is available from the network stack. Not every requestWillBeSent event will have an additional requestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent or requestWillBeSentExtraInfo will be fired first for the same request.

Link copied to clipboard

Fired when resource loading priority is changed

Link copied to clipboard
Link copied to clipboard

Fired when HTTP response is available.

Link copied to clipboard

Fired when additional information about a responseReceived event is available from the network stack. Not every responseReceived event will have an additional responseReceivedExtraInfo for it, and responseReceivedExtraInfo may be fired before or after responseReceived.

Link copied to clipboard

Searches for given string in response content.

Link copied to clipboard

Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted.

Link copied to clipboard

Specifies whether to attach a page script stack id in requests

Link copied to clipboard

Blocks URLs from loading.

Link copied to clipboard

Toggles ignoring of service worker for each request.

Link copied to clipboard

Toggles ignoring cache for each request. If true, cache will not be used.

Link copied to clipboard
inline suspend fun setCookie(name: String, value: String, optionalArgs: SetCookieRequest.Builder.() -> Unit = {}): SetCookieResponse

Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.

Link copied to clipboard

Sets given cookies.

Link copied to clipboard

Specifies whether to always send extra HTTP headers with the requests from this page.

Link copied to clipboard

Sets the requests to intercept that match the provided patterns and optionally resource types. Deprecated, please use Fetch.enable instead.

Link copied to clipboard

Allows overriding user agent with the given string.

Link copied to clipboard

Fired when a signed exchange was received over the network

Fired when request for resources within a .wbn file failed.

Fired when handling requests for resources within a .wbn file. Note: this will only be fired for resources that are requested by the webpage.

Link copied to clipboard

Fired once when parsing the .wbn file has failed.

Fired once when parsing the .wbn file has succeeded. The event contains the information about the web bundle contents.

Link copied to clipboard

Returns a handle to the stream representing the response body. Note that after this command, the intercepted request can't be continued as is -- you either need to cancel it or to provide the response body. The stream only supports sequential read, IO.read will fail if the position is specified.

Link copied to clipboard

Fired exactly once for each Trust Token operation. Depending on the type of the operation and whether the operation succeeded or failed, the event is fired before the corresponding request was sent or after the response was received.

Link copied to clipboard
Link copied to clipboard

Fired when WebSocket is closed.

Link copied to clipboard
Link copied to clipboard

Fired upon WebSocket creation.

Link copied to clipboard

Fired when WebSocket message error occurs.

Link copied to clipboard

Fired when WebSocket message is received.

Link copied to clipboard

Fired when WebSocket message is sent.

Link copied to clipboard

Fired when WebSocket handshake response becomes available.

Link copied to clipboard

Fired when WebSocket is about to initiate handshake.

Link copied to clipboard

Fired when WebTransport is disposed.

Link copied to clipboard

Fired when WebTransport handshake is finished.

Link copied to clipboard

Fired upon WebTransport creation.