Class Network
java.lang.Object
org.openqa.selenium.devtools.v141.network.Network
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.openqa.selenium.devtools.Command<Boolean> Deprecated.static org.openqa.selenium.devtools.Command<Boolean> Deprecated.static org.openqa.selenium.devtools.Command<Boolean> Deprecated.static org.openqa.selenium.devtools.Command<Void> Clears accepted encodings set by setAcceptedEncodingsstatic org.openqa.selenium.devtools.Command<Void> Clears browser cache.static org.openqa.selenium.devtools.Command<Void> Clears browser cookies.static org.openqa.selenium.devtools.Command<Void> continueInterceptedRequest(InterceptionId interceptionId, Optional<ErrorReason> errorReason, Optional<String> rawResponse, Optional<String> url, Optional<String> method, Optional<String> postData, Optional<Headers> headers, Optional<AuthChallengeResponse> authChallengeResponse) Deprecated.static org.openqa.selenium.devtools.Event<DataReceived> static org.openqa.selenium.devtools.Command<Void> deleteCookies(String name, Optional<String> url, Optional<String> domain, Optional<String> path, Optional<CookiePartitionKey> partitionKey) Deletes browser cookies with matching name and url or domain/path/partitionKey pair.static org.openqa.selenium.devtools.Event<DirectTCPSocketAborted> static org.openqa.selenium.devtools.Event<DirectTCPSocketChunkReceived> static org.openqa.selenium.devtools.Event<DirectTCPSocketChunkSent> static org.openqa.selenium.devtools.Event<DirectTCPSocketClosed> static org.openqa.selenium.devtools.Event<DirectTCPSocketCreated> static org.openqa.selenium.devtools.Event<DirectTCPSocketOpened> static org.openqa.selenium.devtools.Event<DirectUDPSocketAborted> static org.openqa.selenium.devtools.Event<DirectUDPSocketChunkReceived> static org.openqa.selenium.devtools.Event<DirectUDPSocketChunkSent> static org.openqa.selenium.devtools.Event<DirectUDPSocketClosed> static org.openqa.selenium.devtools.Event<DirectUDPSocketCreated> static org.openqa.selenium.devtools.Event<DirectUDPSocketOpened> static org.openqa.selenium.devtools.Command<Void> disable()Disables network tracking, prevents network events from being sent to the client.static org.openqa.selenium.devtools.Command<Void> emulateNetworkConditions(Boolean offline, Number latency, Number downloadThroughput, Number uploadThroughput, Optional<ConnectionType> connectionType, Optional<Number> packetLoss, Optional<Integer> packetQueueLength, Optional<Boolean> packetReordering) Activates emulation of network conditions.static org.openqa.selenium.devtools.Command<Void> enable(Optional<Integer> maxTotalBufferSize, Optional<Integer> maxResourceBufferSize, Optional<Integer> maxPostDataSize, Optional<Boolean> reportDirectSocketTraffic, Optional<Boolean> enableDurableMessages) Enables network tracking, network events will now be delivered to the client.static org.openqa.selenium.devtools.Command<Void> enableReportingApi(Boolean enable) Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client.static org.openqa.selenium.devtools.Event<EventSourceMessageReceived> Deprecated.getCertificate(String origin) Returns the DER-encoded certificate.getCookies(Optional<List<String>> urls) Returns all browser cookies for the current URL.static org.openqa.selenium.devtools.Command<IpProxyStatus> Returns enum representing if IP Proxy of requests is available or reason it is not active.static org.openqa.selenium.devtools.Command<String> getRequestPostData(RequestId requestId) Returns post data sent with the request.static org.openqa.selenium.devtools.Command<Network.GetResponseBodyResponse> getResponseBody(RequestId requestId) Returns content served for the given request.static org.openqa.selenium.devtools.Command<Network.GetResponseBodyForInterceptionResponse> getResponseBodyForInterception(InterceptionId interceptionId) Returns content served for the given currently intercepted request.static org.openqa.selenium.devtools.Command<SecurityIsolationStatus> getSecurityIsolationStatus(Optional<FrameId> frameId) Returns information about the COEP/COOP isolation status.static org.openqa.selenium.devtools.Event<LoadingFailed> static org.openqa.selenium.devtools.Event<LoadingFinished> static org.openqa.selenium.devtools.Command<LoadNetworkResourcePageResult> loadNetworkResource(Optional<FrameId> frameId, String url, LoadNetworkResourceOptions options) Fetches the resource and returns the content.static org.openqa.selenium.devtools.Event<Void> static org.openqa.selenium.devtools.Command<Void> This method sends a new XMLHttpRequest which is identical to the original one.static org.openqa.selenium.devtools.Event<ReportingApiEndpointsChangedForOrigin> static org.openqa.selenium.devtools.Event<ReportingApiReport> static org.openqa.selenium.devtools.Event<ReportingApiReport> static org.openqa.selenium.devtools.Event<RequestIntercepted> static org.openqa.selenium.devtools.Event<RequestId> static org.openqa.selenium.devtools.Event<RequestWillBeSent> static org.openqa.selenium.devtools.Event<RequestWillBeSentExtraInfo> static org.openqa.selenium.devtools.Event<ResourceChangedPriority> static org.openqa.selenium.devtools.Event<ResponseReceived> static org.openqa.selenium.devtools.Event<ResponseReceivedEarlyHints> static org.openqa.selenium.devtools.Event<ResponseReceivedExtraInfo> static org.openqa.selenium.devtools.Command<List<SearchMatch>> searchInResponseBody(RequestId requestId, String query, Optional<Boolean> caseSensitive, Optional<Boolean> isRegex) Searches for given string in response content.static org.openqa.selenium.devtools.Command<Void> setAcceptedEncodings(List<ContentEncoding> encodings) Sets a list of content encodings that will be accepted.static org.openqa.selenium.devtools.Command<Void> setAttachDebugStack(Boolean enabled) Specifies whether to attach a page script stack id in requestsstatic org.openqa.selenium.devtools.Command<Void> setBlockedURLs(List<String> urls) Blocks URLs from loading.static org.openqa.selenium.devtools.Command<Void> setBypassServiceWorker(Boolean bypass) Toggles ignoring of service worker for each request.static org.openqa.selenium.devtools.Command<Void> setCacheDisabled(Boolean cacheDisabled) Toggles ignoring cache for each request.static org.openqa.selenium.devtools.Command<Boolean> setCookie(String name, String value, Optional<String> url, Optional<String> domain, Optional<String> path, Optional<Boolean> secure, Optional<Boolean> httpOnly, Optional<CookieSameSite> sameSite, Optional<TimeSinceEpoch> expires, Optional<CookiePriority> priority, Optional<Boolean> sameParty, Optional<CookieSourceScheme> sourceScheme, Optional<Integer> sourcePort, Optional<CookiePartitionKey> partitionKey) Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.static org.openqa.selenium.devtools.Command<Void> setCookieControls(Boolean enableThirdPartyCookieRestriction, Boolean disableThirdPartyCookieMetadata, Boolean disableThirdPartyCookieHeuristics) Sets Controls for third-party cookie access Page reload is required before the new cookie behavior will be observedstatic org.openqa.selenium.devtools.Command<Void> setCookies(List<CookieParam> cookies) Sets given cookies.static org.openqa.selenium.devtools.Command<Void> setExtraHTTPHeaders(Headers headers) Specifies whether to always send extra HTTP headers with the requests from this page.static org.openqa.selenium.devtools.Command<Void> setRequestInterception(List<RequestPattern> patterns) Deprecated.static org.openqa.selenium.devtools.Command<Void> setUserAgentOverride(String userAgent, Optional<String> acceptLanguage, Optional<String> platform, Optional<UserAgentMetadata> userAgentMetadata) Allows overriding user agent with the given string.static org.openqa.selenium.devtools.Event<SignedExchangeReceived> static org.openqa.selenium.devtools.Command<String> streamResourceContent(RequestId requestId) Enables streaming of the response for the given requestId.static org.openqa.selenium.devtools.Event<SubresourceWebBundleInnerResponseError> static org.openqa.selenium.devtools.Event<SubresourceWebBundleInnerResponseParsed> static org.openqa.selenium.devtools.Event<SubresourceWebBundleMetadataError> static org.openqa.selenium.devtools.Event<SubresourceWebBundleMetadataReceived> static org.openqa.selenium.devtools.Command<StreamHandle> takeResponseBodyForInterceptionAsStream(InterceptionId interceptionId) Returns a handle to the stream representing the response body.static org.openqa.selenium.devtools.Event<TrustTokenOperationDone> static org.openqa.selenium.devtools.Event<WebSocketClosed> static org.openqa.selenium.devtools.Event<WebSocketCreated> static org.openqa.selenium.devtools.Event<WebSocketFrameError> static org.openqa.selenium.devtools.Event<WebSocketFrameReceived> static org.openqa.selenium.devtools.Event<WebSocketFrameSent> static org.openqa.selenium.devtools.Event<WebSocketHandshakeResponseReceived> static org.openqa.selenium.devtools.Event<WebSocketWillSendHandshakeRequest> static org.openqa.selenium.devtools.Event<WebTransportClosed> static org.openqa.selenium.devtools.Event<WebTransportConnectionEstablished> static org.openqa.selenium.devtools.Event<WebTransportCreated>
-
Constructor Details
-
Network
public Network()
-
-
Method Details
-
getIPProtectionProxyStatus
@Beta public static org.openqa.selenium.devtools.Command<IpProxyStatus> getIPProtectionProxyStatus()Returns enum representing if IP Proxy of requests is available or reason it is not active. -
setAcceptedEncodings
@Beta public static org.openqa.selenium.devtools.Command<Void> setAcceptedEncodings(List<ContentEncoding> encodings) Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted. -
clearAcceptedEncodingsOverride
Clears accepted encodings set by setAcceptedEncodings -
canClearBrowserCache
Deprecated.Tells whether clearing browser cache is supported. -
canClearBrowserCookies
Deprecated.Tells whether clearing browser cookies is supported. -
canEmulateNetworkConditions
@Deprecated public static org.openqa.selenium.devtools.Command<Boolean> canEmulateNetworkConditions()Deprecated.Tells whether emulation of network conditions is supported. -
clearBrowserCache
Clears browser cache. -
clearBrowserCookies
Clears browser cookies. -
continueInterceptedRequest
@Beta @Deprecated public static org.openqa.selenium.devtools.Command<Void> continueInterceptedRequest(InterceptionId interceptionId, Optional<ErrorReason> errorReason, Optional<String> rawResponse, Optional<String> url, Optional<String> method, Optional<String> postData, Optional<Headers> headers, Optional<AuthChallengeResponse> authChallengeResponse) Deprecated.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. -
deleteCookies
public static org.openqa.selenium.devtools.Command<Void> deleteCookies(String name, Optional<String> url, Optional<String> domain, Optional<String> path, Optional<CookiePartitionKey> partitionKey) Deletes browser cookies with matching name and url or domain/path/partitionKey pair. -
disable
Disables network tracking, prevents network events from being sent to the client. -
emulateNetworkConditions
public static org.openqa.selenium.devtools.Command<Void> emulateNetworkConditions(Boolean offline, Number latency, Number downloadThroughput, Number uploadThroughput, Optional<ConnectionType> connectionType, Optional<Number> packetLoss, Optional<Integer> packetQueueLength, Optional<Boolean> packetReordering) Activates emulation of network conditions. -
enable
public static org.openqa.selenium.devtools.Command<Void> enable(Optional<Integer> maxTotalBufferSize, Optional<Integer> maxResourceBufferSize, Optional<Integer> maxPostDataSize, Optional<Boolean> reportDirectSocketTraffic, Optional<Boolean> enableDurableMessages) Enables network tracking, network events will now be delivered to the client. -
getAllCookies
Deprecated.Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the `cookies` field. Deprecated. Use Storage.getCookies instead. -
getCertificate
@Beta public static org.openqa.selenium.devtools.Command<List<String>> getCertificate(String origin) Returns the DER-encoded certificate. -
getCookies
public static org.openqa.selenium.devtools.Command<List<Cookie>> getCookies(Optional<List<String>> urls) Returns all browser cookies for the current URL. Depending on the backend support, will return detailed cookie information in the `cookies` field. -
getResponseBody
public static org.openqa.selenium.devtools.Command<Network.GetResponseBodyResponse> getResponseBody(RequestId requestId) Returns content served for the given request. -
getRequestPostData
Returns post data sent with the request. Returns an error when no data was sent with the request. -
getResponseBodyForInterception
@Beta public static org.openqa.selenium.devtools.Command<Network.GetResponseBodyForInterceptionResponse> getResponseBodyForInterception(InterceptionId interceptionId) Returns content served for the given currently intercepted request. -
takeResponseBodyForInterceptionAsStream
@Beta public static org.openqa.selenium.devtools.Command<StreamHandle> takeResponseBodyForInterceptionAsStream(InterceptionId interceptionId) 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. -
replayXHR
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. -
searchInResponseBody
@Beta public static org.openqa.selenium.devtools.Command<List<SearchMatch>> searchInResponseBody(RequestId requestId, String query, Optional<Boolean> caseSensitive, Optional<Boolean> isRegex) Searches for given string in response content. -
setBlockedURLs
Blocks URLs from loading. -
setBypassServiceWorker
Toggles ignoring of service worker for each request. -
setCacheDisabled
Toggles ignoring cache for each request. If `true`, cache will not be used. -
setCookie
public static org.openqa.selenium.devtools.Command<Boolean> setCookie(String name, String value, Optional<String> url, Optional<String> domain, Optional<String> path, Optional<Boolean> secure, Optional<Boolean> httpOnly, Optional<CookieSameSite> sameSite, Optional<TimeSinceEpoch> expires, Optional<CookiePriority> priority, Optional<Boolean> sameParty, Optional<CookieSourceScheme> sourceScheme, Optional<Integer> sourcePort, Optional<CookiePartitionKey> partitionKey) Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. -
setCookies
Sets given cookies. -
setExtraHTTPHeaders
Specifies whether to always send extra HTTP headers with the requests from this page. -
setAttachDebugStack
Specifies whether to attach a page script stack id in requests -
setRequestInterception
@Beta @Deprecated public static org.openqa.selenium.devtools.Command<Void> setRequestInterception(List<RequestPattern> patterns) Deprecated.Sets the requests to intercept that match the provided patterns and optionally resource types. Deprecated, please use Fetch.enable instead. -
setUserAgentOverride
public static org.openqa.selenium.devtools.Command<Void> setUserAgentOverride(String userAgent, Optional<String> acceptLanguage, Optional<String> platform, Optional<UserAgentMetadata> userAgentMetadata) Allows overriding user agent with the given string. -
streamResourceContent
@Beta public static org.openqa.selenium.devtools.Command<String> streamResourceContent(RequestId requestId) Enables streaming of the response for the given requestId. If enabled, the dataReceived event contains the data that was received during streaming. -
getSecurityIsolationStatus
@Beta public static org.openqa.selenium.devtools.Command<SecurityIsolationStatus> getSecurityIsolationStatus(Optional<FrameId> frameId) Returns information about the COEP/COOP isolation status. -
enableReportingApi
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. -
loadNetworkResource
@Beta public static org.openqa.selenium.devtools.Command<LoadNetworkResourcePageResult> loadNetworkResource(Optional<FrameId> frameId, String url, LoadNetworkResourceOptions options) Fetches the resource and returns the content. -
setCookieControls
@Beta public static org.openqa.selenium.devtools.Command<Void> setCookieControls(Boolean enableThirdPartyCookieRestriction, Boolean disableThirdPartyCookieMetadata, Boolean disableThirdPartyCookieHeuristics) Sets Controls for third-party cookie access Page reload is required before the new cookie behavior will be observed -
dataReceived
-
eventSourceMessageReceived
public static org.openqa.selenium.devtools.Event<EventSourceMessageReceived> eventSourceMessageReceived() -
loadingFailed
-
loadingFinished
-
requestIntercepted
-
requestServedFromCache
-
requestWillBeSent
-
resourceChangedPriority
-
signedExchangeReceived
-
responseReceived
-
webSocketClosed
-
webSocketCreated
-
webSocketFrameError
-
webSocketFrameReceived
-
webSocketFrameSent
-
webSocketHandshakeResponseReceived
public static org.openqa.selenium.devtools.Event<WebSocketHandshakeResponseReceived> webSocketHandshakeResponseReceived() -
webSocketWillSendHandshakeRequest
public static org.openqa.selenium.devtools.Event<WebSocketWillSendHandshakeRequest> webSocketWillSendHandshakeRequest() -
webTransportCreated
-
webTransportConnectionEstablished
public static org.openqa.selenium.devtools.Event<WebTransportConnectionEstablished> webTransportConnectionEstablished() -
webTransportClosed
-
directTCPSocketCreated
-
directTCPSocketOpened
-
directTCPSocketAborted
-
directTCPSocketClosed
-
directTCPSocketChunkSent
public static org.openqa.selenium.devtools.Event<DirectTCPSocketChunkSent> directTCPSocketChunkSent() -
directTCPSocketChunkReceived
public static org.openqa.selenium.devtools.Event<DirectTCPSocketChunkReceived> directTCPSocketChunkReceived() -
directUDPSocketCreated
-
directUDPSocketOpened
-
directUDPSocketAborted
-
directUDPSocketClosed
-
directUDPSocketChunkSent
public static org.openqa.selenium.devtools.Event<DirectUDPSocketChunkSent> directUDPSocketChunkSent() -
directUDPSocketChunkReceived
public static org.openqa.selenium.devtools.Event<DirectUDPSocketChunkReceived> directUDPSocketChunkReceived() -
requestWillBeSentExtraInfo
public static org.openqa.selenium.devtools.Event<RequestWillBeSentExtraInfo> requestWillBeSentExtraInfo() -
responseReceivedExtraInfo
public static org.openqa.selenium.devtools.Event<ResponseReceivedExtraInfo> responseReceivedExtraInfo() -
responseReceivedEarlyHints
public static org.openqa.selenium.devtools.Event<ResponseReceivedEarlyHints> responseReceivedEarlyHints() -
trustTokenOperationDone
-
policyUpdated
-
subresourceWebBundleMetadataReceived
public static org.openqa.selenium.devtools.Event<SubresourceWebBundleMetadataReceived> subresourceWebBundleMetadataReceived() -
subresourceWebBundleMetadataError
public static org.openqa.selenium.devtools.Event<SubresourceWebBundleMetadataError> subresourceWebBundleMetadataError() -
subresourceWebBundleInnerResponseParsed
public static org.openqa.selenium.devtools.Event<SubresourceWebBundleInnerResponseParsed> subresourceWebBundleInnerResponseParsed() -
subresourceWebBundleInnerResponseError
public static org.openqa.selenium.devtools.Event<SubresourceWebBundleInnerResponseError> subresourceWebBundleInnerResponseError() -
reportingApiReportAdded
-
reportingApiReportUpdated
-
reportingApiEndpointsChangedForOrigin
public static org.openqa.selenium.devtools.Event<ReportingApiEndpointsChangedForOrigin> reportingApiEndpointsChangedForOrigin()
-