Table of Contents

Interface INetwork

Namespace
Selenium.WebDriver.BiDi.Cdp.Network
Assembly
Selenium.WebDriver.BiDi.Cdp.dll

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.

public interface INetwork

Properties

DataReceived

Fired when data chunk was received over the network.

IEventSource<DataReceivedEventArgs> DataReceived { get; }

Property Value

IEventSource<DataReceivedEventArgs>

Remarks

Event args (DataReceivedEventArgs):

  • RequestId - Request identifier.
  • Timestamp - Timestamp.
  • DataLength - Data chunk length.
  • EncodedDataLength - Actual bytes received (might be less than dataLength for compressed encodings).
  • Data - Data that was received. (Encoded as a base64 string when passed over JSON)

DeviceBoundSessionEventOccurred

Triggered when a device bound session event occurs.

[Experimental("BIDICDP001")]
IEventSource<DeviceBoundSessionEventOccurredEventArgs> DeviceBoundSessionEventOccurred { get; }

Property Value

IEventSource<DeviceBoundSessionEventOccurredEventArgs>

Remarks

Event args (DeviceBoundSessionEventOccurredEventArgs):

  • EventId - A unique identifier for this session event.
  • Site - The site this session event is associated with.
  • Succeeded - Whether this event was considered successful.
  • SessionId - The session ID this event is associated with. May not be populated for failed events.
  • CreationEventDetails - The below are the different session event type details. Exactly one is populated.
  • RefreshEventDetails
  • TerminationEventDetails
  • ChallengeEventDetails

DeviceBoundSessionsAdded

Triggered when the initial set of device bound sessions is added.

[Experimental("BIDICDP001")]
IEventSource<DeviceBoundSessionsAddedEventArgs> DeviceBoundSessionsAdded { get; }

Property Value

IEventSource<DeviceBoundSessionsAddedEventArgs>

Remarks

Event args (DeviceBoundSessionsAddedEventArgs):

  • Sessions - The device bound sessions.

DirectTCPSocketAborted

Fired when direct_socket.TCPSocket is aborted.

[Experimental("BIDICDP001")]
IEventSource<DirectTCPSocketAbortedEventArgs> DirectTCPSocketAborted { get; }

Property Value

IEventSource<DirectTCPSocketAbortedEventArgs>

Remarks

Event args (DirectTCPSocketAbortedEventArgs):

  • Identifier
  • ErrorMessage
  • Timestamp

DirectTCPSocketChunkReceived

Fired when data is received from tcp direct socket stream.

[Experimental("BIDICDP001")]
IEventSource<DirectTCPSocketChunkReceivedEventArgs> DirectTCPSocketChunkReceived { get; }

Property Value

IEventSource<DirectTCPSocketChunkReceivedEventArgs>

Remarks

Event args (DirectTCPSocketChunkReceivedEventArgs):

  • Identifier
  • Data
  • Timestamp

DirectTCPSocketChunkSent

Fired when data is sent to tcp direct socket stream.

[Experimental("BIDICDP001")]
IEventSource<DirectTCPSocketChunkSentEventArgs> DirectTCPSocketChunkSent { get; }

Property Value

IEventSource<DirectTCPSocketChunkSentEventArgs>

Remarks

Event args (DirectTCPSocketChunkSentEventArgs):

  • Identifier
  • Data
  • Timestamp

DirectTCPSocketClosed

Fired when direct_socket.TCPSocket is closed.

[Experimental("BIDICDP001")]
IEventSource<DirectTCPSocketClosedEventArgs> DirectTCPSocketClosed { get; }

Property Value

IEventSource<DirectTCPSocketClosedEventArgs>

Remarks

Event args (DirectTCPSocketClosedEventArgs):

  • Identifier
  • Timestamp

DirectTCPSocketCreated

Fired upon direct_socket.TCPSocket creation.

[Experimental("BIDICDP001")]
IEventSource<DirectTCPSocketCreatedEventArgs> DirectTCPSocketCreated { get; }

Property Value

IEventSource<DirectTCPSocketCreatedEventArgs>

Remarks

Event args (DirectTCPSocketCreatedEventArgs):

  • Identifier
  • RemoteAddr
  • RemotePort - Unsigned int 16.
  • Options
  • Timestamp
  • Initiator

DirectTCPSocketOpened

Fired when direct_socket.TCPSocket connection is opened.

[Experimental("BIDICDP001")]
IEventSource<DirectTCPSocketOpenedEventArgs> DirectTCPSocketOpened { get; }

Property Value

IEventSource<DirectTCPSocketOpenedEventArgs>

Remarks

Event args (DirectTCPSocketOpenedEventArgs):

  • Identifier
  • RemoteAddr
  • RemotePort - Expected to be unsigned integer.
  • Timestamp
  • LocalAddr
  • LocalPort - Expected to be unsigned integer.

DirectUDPSocketAborted

Fired when direct_socket.UDPSocket is aborted.

[Experimental("BIDICDP001")]
IEventSource<DirectUDPSocketAbortedEventArgs> DirectUDPSocketAborted { get; }

Property Value

IEventSource<DirectUDPSocketAbortedEventArgs>

Remarks

Event args (DirectUDPSocketAbortedEventArgs):

  • Identifier
  • ErrorMessage
  • Timestamp

DirectUDPSocketChunkReceived

Fired when message is received from udp direct socket stream.

[Experimental("BIDICDP001")]
IEventSource<DirectUDPSocketChunkReceivedEventArgs> DirectUDPSocketChunkReceived { get; }

Property Value

IEventSource<DirectUDPSocketChunkReceivedEventArgs>

Remarks

Event args (DirectUDPSocketChunkReceivedEventArgs):

  • Identifier
  • Message
  • Timestamp

DirectUDPSocketChunkSent

Fired when message is sent to udp direct socket stream.

[Experimental("BIDICDP001")]
IEventSource<DirectUDPSocketChunkSentEventArgs> DirectUDPSocketChunkSent { get; }

Property Value

IEventSource<DirectUDPSocketChunkSentEventArgs>

Remarks

Event args (DirectUDPSocketChunkSentEventArgs):

  • Identifier
  • Message
  • Timestamp

DirectUDPSocketClosed

Fired when direct_socket.UDPSocket is closed.

[Experimental("BIDICDP001")]
IEventSource<DirectUDPSocketClosedEventArgs> DirectUDPSocketClosed { get; }

Property Value

IEventSource<DirectUDPSocketClosedEventArgs>

Remarks

Event args (DirectUDPSocketClosedEventArgs):

  • Identifier
  • Timestamp

DirectUDPSocketCreated

Fired upon direct_socket.UDPSocket creation.

[Experimental("BIDICDP001")]
IEventSource<DirectUDPSocketCreatedEventArgs> DirectUDPSocketCreated { get; }

Property Value

IEventSource<DirectUDPSocketCreatedEventArgs>

Remarks

Event args (DirectUDPSocketCreatedEventArgs):

  • Identifier
  • Options
  • Timestamp
  • Initiator

DirectUDPSocketJoinedMulticastGroup

[Experimental("BIDICDP001")]
IEventSource<DirectUDPSocketJoinedMulticastGroupEventArgs> DirectUDPSocketJoinedMulticastGroup { get; }

Property Value

IEventSource<DirectUDPSocketJoinedMulticastGroupEventArgs>

Remarks

Event args (DirectUDPSocketJoinedMulticastGroupEventArgs):

  • Identifier
  • IPAddress

DirectUDPSocketLeftMulticastGroup

[Experimental("BIDICDP001")]
IEventSource<DirectUDPSocketLeftMulticastGroupEventArgs> DirectUDPSocketLeftMulticastGroup { get; }

Property Value

IEventSource<DirectUDPSocketLeftMulticastGroupEventArgs>

Remarks

Event args (DirectUDPSocketLeftMulticastGroupEventArgs):

  • Identifier
  • IPAddress

DirectUDPSocketOpened

Fired when direct_socket.UDPSocket connection is opened.

[Experimental("BIDICDP001")]
IEventSource<DirectUDPSocketOpenedEventArgs> DirectUDPSocketOpened { get; }

Property Value

IEventSource<DirectUDPSocketOpenedEventArgs>

Remarks

Event args (DirectUDPSocketOpenedEventArgs):

  • Identifier
  • LocalAddr
  • LocalPort - Expected to be unsigned integer.
  • Timestamp
  • RemoteAddr
  • RemotePort - Expected to be unsigned integer.

EventSourceMessageReceived

Fired when EventSource message is received.

IEventSource<EventSourceMessageReceivedEventArgs> EventSourceMessageReceived { get; }

Property Value

IEventSource<EventSourceMessageReceivedEventArgs>

Remarks

Event args (EventSourceMessageReceivedEventArgs):

  • RequestId - Request identifier.
  • Timestamp - Timestamp.
  • EventName - Message type.
  • EventId - Message identifier.
  • Data - Message content.

LoadingFailed

Fired when HTTP request has failed to load.

IEventSource<LoadingFailedEventArgs> LoadingFailed { get; }

Property Value

IEventSource<LoadingFailedEventArgs>

Remarks

Event args (LoadingFailedEventArgs):

  • RequestId - Request identifier.
  • Timestamp - Timestamp.
  • Type - Resource type.
  • ErrorText - Error message. List of network errors: https://cs.chromium.org/chromium/src/net/base/net_error_list.h
  • Canceled - True if loading was canceled.
  • BlockedReason - The reason why loading was blocked, if any.
  • CorsErrorStatus - The reason why loading was blocked by CORS, if any.

LoadingFinished

Fired when HTTP request has finished loading.

IEventSource<LoadingFinishedEventArgs> LoadingFinished { get; }

Property Value

IEventSource<LoadingFinishedEventArgs>

Remarks

Event args (LoadingFinishedEventArgs):

  • RequestId - Request identifier.
  • Timestamp - Timestamp.
  • EncodedDataLength - Total number of bytes received for this request.

PolicyUpdated

Fired once security policy has been updated.

[Experimental("BIDICDP001")]
IEventSource<PolicyUpdatedEventArgs> PolicyUpdated { get; }

Property Value

IEventSource<PolicyUpdatedEventArgs>

ReportingApiEndpointsChangedForOrigin

[Experimental("BIDICDP001")]
IEventSource<ReportingApiEndpointsChangedForOriginEventArgs> ReportingApiEndpointsChangedForOrigin { get; }

Property Value

IEventSource<ReportingApiEndpointsChangedForOriginEventArgs>

Remarks

Event args (ReportingApiEndpointsChangedForOriginEventArgs):

  • Origin - Origin of the document(s) which configured the endpoints.
  • Endpoints

ReportingApiReportAdded

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

[Experimental("BIDICDP001")]
IEventSource<ReportingApiReportAddedEventArgs> ReportingApiReportAdded { get; }

Property Value

IEventSource<ReportingApiReportAddedEventArgs>

Remarks

Event args (ReportingApiReportAddedEventArgs):

  • Report

ReportingApiReportUpdated

[Experimental("BIDICDP001")]
IEventSource<ReportingApiReportUpdatedEventArgs> ReportingApiReportUpdated { get; }

Property Value

IEventSource<ReportingApiReportUpdatedEventArgs>

Remarks

RequestServedFromCache

Fired if request ended up loading from cache.

IEventSource<RequestServedFromCacheEventArgs> RequestServedFromCache { get; }

Property Value

IEventSource<RequestServedFromCacheEventArgs>

Remarks

Event args (RequestServedFromCacheEventArgs):

  • RequestId - Request identifier.

RequestWillBeSent

Fired when page is about to send HTTP request.

IEventSource<RequestWillBeSentEventArgs> RequestWillBeSent { get; }

Property Value

IEventSource<RequestWillBeSentEventArgs>

Remarks

Event args (RequestWillBeSentEventArgs):

  • RequestId - Request identifier.
  • LoaderId - Loader identifier. Empty string if the request is fetched from worker.
  • DocumentURL - URL of the document this request is loaded for.
  • Request - Request data.
  • Timestamp - Timestamp.
  • WallTime - Timestamp.
  • Initiator - Request initiator.
  • RedirectHasExtraInfo - In the case that redirectResponse is populated, this flag indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted for the request which was just redirected.
  • RedirectResponse - Redirect response data.
  • Type - Type of this resource.
  • FrameId - Frame identifier.
  • HasUserGesture - Whether the request is initiated by a user gesture. Defaults to false.
  • RenderBlockingBehavior - The render-blocking behavior of the request.

RequestWillBeSentExtraInfo

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.

[Experimental("BIDICDP001")]
IEventSource<RequestWillBeSentExtraInfoEventArgs> RequestWillBeSentExtraInfo { get; }

Property Value

IEventSource<RequestWillBeSentExtraInfoEventArgs>

Remarks

Event args (RequestWillBeSentExtraInfoEventArgs):

  • RequestId - Request identifier. Used to match this information to an existing requestWillBeSent event.
  • AssociatedCookies - A list of cookies potentially associated to the requested URL. This includes both cookies sent with the request and the ones not sent; the latter are distinguished by having blockedReasons field set.
  • Headers - Raw request headers as they will be sent over the wire.
  • ConnectTiming - Connection timing information for the request.
  • DeviceBoundSessionUsages - How the request site's device bound sessions were used during this request.
  • ClientSecurityState - The client security state set for the request.
  • SiteHasCookieInOtherPartition - Whether the site has partitioned cookies stored in a partition different than the current one.
  • AppliedNetworkConditionsId - The network conditions id if this request was affected by network conditions configured via emulateNetworkConditionsByRule.

ResourceChangedPriority

Fired when resource loading priority is changed

[Experimental("BIDICDP001")]
IEventSource<ResourceChangedPriorityEventArgs> ResourceChangedPriority { get; }

Property Value

IEventSource<ResourceChangedPriorityEventArgs>

Remarks

Event args (ResourceChangedPriorityEventArgs):

  • RequestId - Request identifier.
  • NewPriority - New priority
  • Timestamp - Timestamp.

ResponseReceived

Fired when HTTP response is available.

IEventSource<ResponseReceivedEventArgs> ResponseReceived { get; }

Property Value

IEventSource<ResponseReceivedEventArgs>

Remarks

Event args (ResponseReceivedEventArgs):

  • RequestId - Request identifier.
  • LoaderId - Loader identifier. Empty string if the request is fetched from worker.
  • Timestamp - Timestamp.
  • Type - Resource type.
  • Response - Response data.
  • HasExtraInfo - Indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted for this request.
  • FrameId - Frame identifier.

ResponseReceivedEarlyHints

Fired when 103 Early Hints headers is received in addition to the common response. Not every responseReceived event will have an responseReceivedEarlyHints fired. Only one responseReceivedEarlyHints may be fired for eached responseReceived event.

[Experimental("BIDICDP001")]
IEventSource<ResponseReceivedEarlyHintsEventArgs> ResponseReceivedEarlyHints { get; }

Property Value

IEventSource<ResponseReceivedEarlyHintsEventArgs>

Remarks

Event args (ResponseReceivedEarlyHintsEventArgs):

  • RequestId - Request identifier. Used to match this information to another responseReceived event.
  • Headers - Raw response headers as they were received over the wire. Duplicate headers in the response are represented as a single key with their values concatentated using \n as the separator. See also headersText that contains verbatim text for HTTP/1.*.

ResponseReceivedExtraInfo

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.

[Experimental("BIDICDP001")]
IEventSource<ResponseReceivedExtraInfoEventArgs> ResponseReceivedExtraInfo { get; }

Property Value

IEventSource<ResponseReceivedExtraInfoEventArgs>

Remarks

Event args (ResponseReceivedExtraInfoEventArgs):

  • RequestId - Request identifier. Used to match this information to another responseReceived event.
  • BlockedCookies - A list of cookies which were not stored from the response along with the corresponding reasons for blocking. The cookies here may not be valid due to syntax errors, which are represented by the invalid cookie line string instead of a proper cookie.
  • Headers - Raw response headers as they were received over the wire. Duplicate headers in the response are represented as a single key with their values concatentated using \n as the separator. See also headersText that contains verbatim text for HTTP/1.*.
  • ResourceIPAddressSpace - The IP address space of the resource. The address space can only be determined once the transport established the connection, so we can't send it in requestWillBeSentExtraInfo.
  • StatusCode - The status code of the response. This is useful in cases the request failed and no responseReceived event is triggered, which is the case for, e.g., CORS errors. This is also the correct status code for cached requests, where the status in responseReceived is a 200 and this will be 304.
  • HeadersText - Raw response header text as it was received over the wire. The raw text may not always be available, such as in the case of HTTP/2 or QUIC.
  • CookiePartitionKey - The cookie partition key that will be used to store partitioned cookies set in this response. Only sent when partitioned cookies are enabled.
  • CookiePartitionKeyOpaque - True if partitioned cookies are enabled, but the partition key is not serializable to string.
  • ExemptedCookies - A list of cookies which should have been blocked by 3PCD but are exempted and stored from the response with the corresponding reason.

SignedExchangeReceived

Fired when a signed exchange was received over the network

[Experimental("BIDICDP001")]
IEventSource<SignedExchangeReceivedEventArgs> SignedExchangeReceived { get; }

Property Value

IEventSource<SignedExchangeReceivedEventArgs>

Remarks

Event args (SignedExchangeReceivedEventArgs):

  • RequestId - Request identifier.
  • Info - Information about the signed exchange response.

TrustTokenOperationDone

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.

[Experimental("BIDICDP001")]
IEventSource<TrustTokenOperationDoneEventArgs> TrustTokenOperationDone { get; }

Property Value

IEventSource<TrustTokenOperationDoneEventArgs>

Remarks

Event args (TrustTokenOperationDoneEventArgs):

  • Status - Detailed success or error status of the operation. 'AlreadyExists' also signifies a successful operation, as the result of the operation already exists und thus, the operation was abort preemptively (e.g. a cache hit).
  • Type
  • RequestId
  • TopLevelOrigin - Top level origin. The context in which the operation was attempted.
  • IssuerOrigin - Origin of the issuer in case of a "Issuance" or "Redemption" operation.
  • IssuedTokenCount - The number of obtained Trust Tokens on a successful "Issuance" operation.

WebSocketClosed

Fired when WebSocket is closed.

IEventSource<WebSocketClosedEventArgs> WebSocketClosed { get; }

Property Value

IEventSource<WebSocketClosedEventArgs>

Remarks

Event args (WebSocketClosedEventArgs):

  • RequestId - Request identifier.
  • Timestamp - Timestamp.

WebSocketCreated

Fired upon WebSocket creation.

IEventSource<WebSocketCreatedEventArgs> WebSocketCreated { get; }

Property Value

IEventSource<WebSocketCreatedEventArgs>

Remarks

Event args (WebSocketCreatedEventArgs):

  • RequestId - Request identifier.
  • Url - WebSocket request URL.
  • Initiator - Request initiator.

WebSocketFrameError

Fired when WebSocket message error occurs.

IEventSource<WebSocketFrameErrorEventArgs> WebSocketFrameError { get; }

Property Value

IEventSource<WebSocketFrameErrorEventArgs>

Remarks

Event args (WebSocketFrameErrorEventArgs):

  • RequestId - Request identifier.
  • Timestamp - Timestamp.
  • ErrorMessage - WebSocket error message.

WebSocketFrameReceived

Fired when WebSocket message is received.

IEventSource<WebSocketFrameReceivedEventArgs> WebSocketFrameReceived { get; }

Property Value

IEventSource<WebSocketFrameReceivedEventArgs>

Remarks

Event args (WebSocketFrameReceivedEventArgs):

  • RequestId - Request identifier.
  • Timestamp - Timestamp.
  • Response - WebSocket response data.

WebSocketFrameSent

Fired when WebSocket message is sent.

IEventSource<WebSocketFrameSentEventArgs> WebSocketFrameSent { get; }

Property Value

IEventSource<WebSocketFrameSentEventArgs>

Remarks

Event args (WebSocketFrameSentEventArgs):

  • RequestId - Request identifier.
  • Timestamp - Timestamp.
  • Response - WebSocket response data.

WebSocketHandshakeResponseReceived

Fired when WebSocket handshake response becomes available.

IEventSource<WebSocketHandshakeResponseReceivedEventArgs> WebSocketHandshakeResponseReceived { get; }

Property Value

IEventSource<WebSocketHandshakeResponseReceivedEventArgs>

Remarks

Event args (WebSocketHandshakeResponseReceivedEventArgs):

  • RequestId - Request identifier.
  • Timestamp - Timestamp.
  • Response - WebSocket response data.

WebSocketWillSendHandshakeRequest

Fired when WebSocket is about to initiate handshake.

IEventSource<WebSocketWillSendHandshakeRequestEventArgs> WebSocketWillSendHandshakeRequest { get; }

Property Value

IEventSource<WebSocketWillSendHandshakeRequestEventArgs>

Remarks

Event args (WebSocketWillSendHandshakeRequestEventArgs):

  • RequestId - Request identifier.
  • Timestamp - Timestamp.
  • WallTime - UTC Timestamp.
  • Request - WebSocket request data.

WebTransportClosed

Fired when WebTransport is disposed.

IEventSource<WebTransportClosedEventArgs> WebTransportClosed { get; }

Property Value

IEventSource<WebTransportClosedEventArgs>

Remarks

Event args (WebTransportClosedEventArgs):

  • TransportId - WebTransport identifier.
  • Timestamp - Timestamp.

WebTransportConnectionEstablished

Fired when WebTransport handshake is finished.

IEventSource<WebTransportConnectionEstablishedEventArgs> WebTransportConnectionEstablished { get; }

Property Value

IEventSource<WebTransportConnectionEstablishedEventArgs>

Remarks

Event args (WebTransportConnectionEstablishedEventArgs):

  • TransportId - WebTransport identifier.
  • Timestamp - Timestamp.

WebTransportCreated

Fired upon WebTransport creation.

IEventSource<WebTransportCreatedEventArgs> WebTransportCreated { get; }

Property Value

IEventSource<WebTransportCreatedEventArgs>

Remarks

Event args (WebTransportCreatedEventArgs):

  • TransportId - WebTransport identifier.
  • Url - WebTransport request URL.
  • Timestamp - Timestamp.
  • Initiator - Request initiator.

Methods

CanClearBrowserCacheAsync(string?, CancellationToken)

Tells whether clearing browser cache is supported.

[Obsolete]
Task<CanClearBrowserCacheResult> CanClearBrowserCacheAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<CanClearBrowserCacheResult>

A task representing the asynchronous operation, containing a CanClearBrowserCacheResult.

CanClearBrowserCookiesAsync(string?, CancellationToken)

Tells whether clearing browser cookies is supported.

[Obsolete]
Task<CanClearBrowserCookiesResult> CanClearBrowserCookiesAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<CanClearBrowserCookiesResult>

A task representing the asynchronous operation, containing a CanClearBrowserCookiesResult.

CanEmulateNetworkConditionsAsync(string?, CancellationToken)

Tells whether emulation of network conditions is supported.

[Obsolete]
Task<CanEmulateNetworkConditionsResult> CanEmulateNetworkConditionsAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<CanEmulateNetworkConditionsResult>

A task representing the asynchronous operation, containing a CanEmulateNetworkConditionsResult.

ClearBrowserCacheAsync(string?, CancellationToken)

Clears browser cache.

Task<ClearBrowserCacheResult> ClearBrowserCacheAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<ClearBrowserCacheResult>

A task representing the asynchronous operation, containing a ClearBrowserCacheResult.

ClearBrowserCookiesAsync(string?, CancellationToken)

Clears browser cookies.

Task<ClearBrowserCookiesResult> ClearBrowserCookiesAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<ClearBrowserCookiesResult>

A task representing the asynchronous operation, containing a ClearBrowserCookiesResult.

ConfigureDurableMessagesAsync(long?, long?, string?, CancellationToken)

Configures storing response bodies outside of renderer, so that these survive a cross-process navigation. If maxTotalBufferSize is not set, durable messages are disabled.

[Experimental("BIDICDP001")]
Task<ConfigureDurableMessagesResult> ConfigureDurableMessagesAsync(long? maxTotalBufferSize = null, long? maxResourceBufferSize = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

maxTotalBufferSize long?

Buffer size in bytes to use when preserving network payloads (XHRs, etc).

maxResourceBufferSize long?

Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<ConfigureDurableMessagesResult>

A task representing the asynchronous operation, containing a ConfigureDurableMessagesResult.

DeleteCookiesAsync(string, string?, string?, string?, CookiePartitionKey?, string?, CancellationToken)

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

Task<DeleteCookiesResult> DeleteCookiesAsync(string name, string? url = null, string? domain = null, string? path = null, CookiePartitionKey? partitionKey = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

name string

Name of the cookies to remove.

url string

If specified, deletes all the cookies with the given name where domain and path match provided URL.

domain string

If specified, deletes only cookies with the exact domain.

path string

If specified, deletes only cookies with the exact path.

partitionKey CookiePartitionKey

If specified, deletes only cookies with the the given name and partitionKey where all partition key attributes match the cookie partition key attribute.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<DeleteCookiesResult>

A task representing the asynchronous operation, containing a DeleteCookiesResult.

DeleteDeviceBoundSessionAsync(DeviceBoundSessionKey, string?, CancellationToken)

Deletes a device bound session.

[Experimental("BIDICDP001")]
Task<DeleteDeviceBoundSessionResult> DeleteDeviceBoundSessionAsync(DeviceBoundSessionKey key, string? session = null, CancellationToken cancellationToken = default)

Parameters

key DeviceBoundSessionKey
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<DeleteDeviceBoundSessionResult>

A task representing the asynchronous operation, containing a DeleteDeviceBoundSessionResult.

DisableAsync(string?, CancellationToken)

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

Task<DisableResult> DisableAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<DisableResult>

A task representing the asynchronous operation, containing a DisableResult.

EmulateNetworkConditionsAsync(bool, double, double, double, ConnectionType?, double?, long?, bool?, string?, CancellationToken)

Activates emulation of network conditions. This command is deprecated in favor of the emulateNetworkConditionsByRule and overrideNetworkState commands, which can be used together to the same effect.

[Obsolete]
Task<EmulateNetworkConditionsResult> EmulateNetworkConditionsAsync(bool offline, double latency, double downloadThroughput, double uploadThroughput, ConnectionType? connectionType = null, double? packetLoss = null, long? packetQueueLength = null, bool? packetReordering = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

offline bool

True to emulate internet disconnection.

latency double

Minimum latency from request sent to response headers received (ms).

downloadThroughput double

Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.

uploadThroughput double

Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.

connectionType ConnectionType?

Connection type if known.

packetLoss double?

WebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets.

packetQueueLength long?

WebRTC packet queue length (packet). 0 removes any queue length limitations.

packetReordering bool?

WebRTC packetReordering feature.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<EmulateNetworkConditionsResult>

A task representing the asynchronous operation, containing a EmulateNetworkConditionsResult.

EmulateNetworkConditionsByRuleAsync(ImmutableArray<NetworkConditions>, bool?, bool?, string?, CancellationToken)

Activates emulation of network conditions for individual requests using URL match patterns. Unlike the deprecated Network.emulateNetworkConditions this method does not affect navigator state. Use Network.overrideNetworkState to explicitly modify navigator behavior.

[Experimental("BIDICDP001")]
Task<EmulateNetworkConditionsByRuleResult> EmulateNetworkConditionsByRuleAsync(ImmutableArray<NetworkConditions> matchedNetworkConditions, bool? offline = null, bool? emulateOfflineServiceWorker = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

matchedNetworkConditions ImmutableArray<NetworkConditions>

Configure conditions for matching requests. If multiple entries match a request, the first entry wins. Global conditions can be configured by leaving the urlPattern for the conditions empty. These global conditions are also applied for throttling of p2p connections.

offline bool?

True to emulate internet disconnection. Deprecated, use the offline property in matchedNetworkConditions or emulateOfflineServiceWorker instead.

emulateOfflineServiceWorker bool?

True to emulate offline service worker.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<EmulateNetworkConditionsByRuleResult>

A task representing the asynchronous operation, containing a EmulateNetworkConditionsByRuleResult.

EnableAsync(long?, long?, long?, bool?, bool?, string?, CancellationToken)

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

Task<EnableResult> EnableAsync(long? maxTotalBufferSize = null, long? maxResourceBufferSize = null, long? maxPostDataSize = null, bool? reportDirectSocketTraffic = null, bool? enableDurableMessages = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

maxTotalBufferSize long?

Buffer size in bytes to use when preserving network payloads (XHRs, etc). This is the maximum number of bytes that will be collected by this DevTools session.

maxResourceBufferSize long?

Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).

maxPostDataSize long?

Longest post body size (in bytes) that would be included in requestWillBeSent notification

reportDirectSocketTraffic bool?

Whether DirectSocket chunk send/receive events should be reported.

enableDurableMessages bool?

Enable storing response bodies outside of renderer, so that these survive a cross-process navigation. Requires maxTotalBufferSize to be set. Currently defaults to false. This field is being deprecated in favor of the dedicated configureDurableMessages command, due to the possibility of deadlocks when awaiting Network.enable before issuing Runtime.runIfWaitingForDebugger.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<EnableResult>

A task representing the asynchronous operation, containing a EnableResult.

EnableDeviceBoundSessionsAsync(bool, string?, CancellationToken)

Sets up tracking device bound sessions and fetching of initial set of sessions.

[Experimental("BIDICDP001")]
Task<EnableDeviceBoundSessionsResult> EnableDeviceBoundSessionsAsync(bool enable, string? session = null, CancellationToken cancellationToken = default)

Parameters

enable bool

Whether to enable or disable events.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<EnableDeviceBoundSessionsResult>

A task representing the asynchronous operation, containing a EnableDeviceBoundSessionsResult.

EnableReportingApiAsync(bool, string?, CancellationToken)

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.

[Experimental("BIDICDP001")]
Task<EnableReportingApiResult> EnableReportingApiAsync(bool enable, string? session = null, CancellationToken cancellationToken = default)

Parameters

enable bool

Whether to enable or disable events for the Reporting API

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<EnableReportingApiResult>

A task representing the asynchronous operation, containing a EnableReportingApiResult.

FetchSchemefulSiteAsync(string, string?, CancellationToken)

Fetches the schemeful site for a specific origin.

[Experimental("BIDICDP001")]
Task<FetchSchemefulSiteResult> FetchSchemefulSiteAsync(string origin, string? session = null, CancellationToken cancellationToken = default)

Parameters

origin string

The URL origin.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<FetchSchemefulSiteResult>

A task representing the asynchronous operation, containing a FetchSchemefulSiteResult.

GetAllCookiesAsync(string?, CancellationToken)

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

[Obsolete]
Task<GetAllCookiesResult> GetAllCookiesAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetAllCookiesResult>

A task representing the asynchronous operation, containing a GetAllCookiesResult.

GetCertificateAsync(string, string?, CancellationToken)

Returns the DER-encoded certificate.

[Experimental("BIDICDP001")]
Task<GetCertificateResult> GetCertificateAsync(string origin, string? session = null, CancellationToken cancellationToken = default)

Parameters

origin string

Origin to get certificate for.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetCertificateResult>

A task representing the asynchronous operation, containing a GetCertificateResult.

GetCookiesAsync(ImmutableArray<string>?, string?, CancellationToken)

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

Task<GetCookiesResult> GetCookiesAsync(ImmutableArray<string>? urls = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

urls ImmutableArray<string>?

The list of URLs for which applicable cookies will be fetched. If not specified, it's assumed to be set to the list containing the URLs of the page and all of its subframes.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetCookiesResult>

A task representing the asynchronous operation, containing a GetCookiesResult.

GetRequestPostDataAsync(RequestId, string?, CancellationToken)

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

Task<GetRequestPostDataResult> GetRequestPostDataAsync(RequestId requestId, string? session = null, CancellationToken cancellationToken = default)

Parameters

requestId RequestId

Identifier of the network request to get content for.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetRequestPostDataResult>

A task representing the asynchronous operation, containing a GetRequestPostDataResult.

GetResponseBodyAsync(RequestId, string?, CancellationToken)

Returns content served for the given request.

Task<GetResponseBodyResult> GetResponseBodyAsync(RequestId requestId, string? session = null, CancellationToken cancellationToken = default)

Parameters

requestId RequestId

Identifier of the network request to get content for.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetResponseBodyResult>

A task representing the asynchronous operation, containing a GetResponseBodyResult.

GetSecurityIsolationStatusAsync(FrameId?, string?, CancellationToken)

Returns information about the COEP/COOP isolation status.

[Experimental("BIDICDP001")]
Task<GetSecurityIsolationStatusResult> GetSecurityIsolationStatusAsync(FrameId? frameId = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

frameId FrameId

If no frameId is provided, the status of the target is provided.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetSecurityIsolationStatusResult>

A task representing the asynchronous operation, containing a GetSecurityIsolationStatusResult.

LoadNetworkResourceAsync(string, LoadNetworkResourceOptions, FrameId?, string?, CancellationToken)

Fetches the resource and returns the content.

[Experimental("BIDICDP001")]
Task<LoadNetworkResourceResult> LoadNetworkResourceAsync(string url, LoadNetworkResourceOptions options, FrameId? frameId = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

url string

URL of the resource to get content for.

options LoadNetworkResourceOptions

Options for the request.

frameId FrameId

Frame id to get the resource for. Mandatory for frame targets, and should be omitted for worker targets.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<LoadNetworkResourceResult>

A task representing the asynchronous operation, containing a LoadNetworkResourceResult.

OverrideNetworkStateAsync(bool, double, double, double, ConnectionType?, string?, CancellationToken)

Override the state of navigator.onLine and navigator.connection.

[Experimental("BIDICDP001")]
Task<OverrideNetworkStateResult> OverrideNetworkStateAsync(bool offline, double latency, double downloadThroughput, double uploadThroughput, ConnectionType? connectionType = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

offline bool

True to emulate internet disconnection.

latency double

Minimum latency from request sent to response headers received (ms).

downloadThroughput double

Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.

uploadThroughput double

Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.

connectionType ConnectionType?

Connection type if known.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<OverrideNetworkStateResult>

A task representing the asynchronous operation, containing a OverrideNetworkStateResult.

ReplayXHRAsync(RequestId, string?, CancellationToken)

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.

[Experimental("BIDICDP001")]
Task<ReplayXHRResult> ReplayXHRAsync(RequestId requestId, string? session = null, CancellationToken cancellationToken = default)

Parameters

requestId RequestId

Identifier of XHR to replay.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<ReplayXHRResult>

A task representing the asynchronous operation, containing a ReplayXHRResult.

SearchInResponseBodyAsync(RequestId, string, bool?, bool?, string?, CancellationToken)

Searches for given string in response content.

[Experimental("BIDICDP001")]
Task<SearchInResponseBodyResult> SearchInResponseBodyAsync(RequestId requestId, string query, bool? caseSensitive = null, bool? isRegex = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

requestId RequestId

Identifier of the network response to search.

query string

String to search for.

caseSensitive bool?

If true, search is case sensitive.

isRegex bool?

If true, treats string parameter as regex.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SearchInResponseBodyResult>

A task representing the asynchronous operation, containing a SearchInResponseBodyResult.

SetAttachDebugStackAsync(bool, string?, CancellationToken)

Specifies whether to attach a page script stack id in requests

[Experimental("BIDICDP001")]
Task<SetAttachDebugStackResult> SetAttachDebugStackAsync(bool enabled, string? session = null, CancellationToken cancellationToken = default)

Parameters

enabled bool

Whether to attach a page script stack for debugging purpose.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetAttachDebugStackResult>

A task representing the asynchronous operation, containing a SetAttachDebugStackResult.

SetBlockedURLsAsync(ImmutableArray<BlockPattern>?, ImmutableArray<string>?, string?, CancellationToken)

Blocks URLs from loading.

[Experimental("BIDICDP001")]
Task<SetBlockedURLsResult> SetBlockedURLsAsync(ImmutableArray<BlockPattern>? urlPatterns = null, ImmutableArray<string>? urls = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

urlPatterns ImmutableArray<BlockPattern>?

Patterns to match in the order in which they are given. These patterns also take precedence over any wildcard patterns defined in urls.

urls ImmutableArray<string>?

URL patterns to block. Wildcards ('*') are allowed.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetBlockedURLsResult>

A task representing the asynchronous operation, containing a SetBlockedURLsResult.

SetBypassServiceWorkerAsync(bool, string?, CancellationToken)

Toggles ignoring of service worker for each request.

Task<SetBypassServiceWorkerResult> SetBypassServiceWorkerAsync(bool bypass, string? session = null, CancellationToken cancellationToken = default)

Parameters

bypass bool

Bypass service worker and load from network.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetBypassServiceWorkerResult>

A task representing the asynchronous operation, containing a SetBypassServiceWorkerResult.

SetCacheDisabledAsync(bool, string?, CancellationToken)

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

Task<SetCacheDisabledResult> SetCacheDisabledAsync(bool cacheDisabled, string? session = null, CancellationToken cancellationToken = default)

Parameters

cacheDisabled bool

Cache disabled state.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetCacheDisabledResult>

A task representing the asynchronous operation, containing a SetCacheDisabledResult.

SetCookieAsync(string, string, string?, string?, string?, bool?, bool?, CookieSameSite?, TimeSinceEpoch?, CookiePriority?, CookieSourceScheme?, long?, CookiePartitionKey?, string?, CancellationToken)

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

Task<SetCookieResult> SetCookieAsync(string name, string value, string? url = null, string? domain = null, string? path = null, bool? secure = null, bool? httpOnly = null, CookieSameSite? sameSite = null, TimeSinceEpoch? expires = null, CookiePriority? priority = null, CookieSourceScheme? sourceScheme = null, long? sourcePort = null, CookiePartitionKey? partitionKey = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

name string

Cookie name.

value string

Cookie value.

url string

The request-URI to associate with the setting of the cookie. This value can affect the default domain, path, source port, and source scheme values of the created cookie.

domain string

Cookie domain.

path string

Cookie path.

secure bool?

True if cookie is secure.

httpOnly bool?

True if cookie is http-only.

sameSite CookieSameSite?

Cookie SameSite type.

expires TimeSinceEpoch

Cookie expiration date, session cookie if not set

priority CookiePriority?

Cookie Priority type.

sourceScheme CookieSourceScheme?

Cookie source scheme type.

sourcePort long?

Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. This is a temporary ability and it will be removed in the future.

partitionKey CookiePartitionKey

Cookie partition key. If not set, the cookie will be set as not partitioned.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetCookieResult>

A task representing the asynchronous operation, containing a SetCookieResult.

SetCookieControlsAsync(bool, string?, CancellationToken)

Sets Controls for third-party cookie access Page reload is required before the new cookie behavior will be observed

[Experimental("BIDICDP001")]
Task<SetCookieControlsResult> SetCookieControlsAsync(bool enableThirdPartyCookieRestriction, string? session = null, CancellationToken cancellationToken = default)

Parameters

enableThirdPartyCookieRestriction bool

Whether 3pc restriction is enabled.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetCookieControlsResult>

A task representing the asynchronous operation, containing a SetCookieControlsResult.

SetCookiesAsync(ImmutableArray<CookieParam>, string?, CancellationToken)

Sets given cookies.

Task<SetCookiesResult> SetCookiesAsync(ImmutableArray<CookieParam> cookies, string? session = null, CancellationToken cancellationToken = default)

Parameters

cookies ImmutableArray<CookieParam>

Cookies to be set.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetCookiesResult>

A task representing the asynchronous operation, containing a SetCookiesResult.

SetExtraHTTPHeadersAsync(IReadOnlyDictionary<string, string>, string?, CancellationToken)

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

Task<SetExtraHTTPHeadersResult> SetExtraHTTPHeadersAsync(IReadOnlyDictionary<string, string> headers, string? session = null, CancellationToken cancellationToken = default)

Parameters

headers IReadOnlyDictionary<string, string>

Map with extra HTTP headers.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetExtraHTTPHeadersResult>

A task representing the asynchronous operation, containing a SetExtraHTTPHeadersResult.

SetUserAgentOverrideAsync(string, string?, string?, UserAgentMetadata?, string?, CancellationToken)

Allows overriding user agent with the given string.

Task<SetUserAgentOverrideResult> SetUserAgentOverrideAsync(string userAgent, string? acceptLanguage = null, string? platform = null, UserAgentMetadata? userAgentMetadata = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

userAgent string

User agent to use.

acceptLanguage string

Browser language to emulate.

platform string

The platform navigator.platform should return.

userAgentMetadata UserAgentMetadata

To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetUserAgentOverrideResult>

A task representing the asynchronous operation, containing a SetUserAgentOverrideResult.

StreamResourceContentAsync(RequestId, string?, CancellationToken)

Enables streaming of the response for the given requestId. If enabled, the dataReceived event contains the data that was received during streaming.

[Experimental("BIDICDP001")]
Task<StreamResourceContentResult> StreamResourceContentAsync(RequestId requestId, string? session = null, CancellationToken cancellationToken = default)

Parameters

requestId RequestId

Identifier of the request to stream.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<StreamResourceContentResult>

A task representing the asynchronous operation, containing a StreamResourceContentResult.