public interface Network
| Modifier and Type | Method and Description |
|---|---|
Boolean |
canClearBrowserCache()
Deprecated.
|
Boolean |
canClearBrowserCookies()
Deprecated.
|
Boolean |
canEmulateNetworkConditions()
Deprecated.
|
void |
clearAcceptedEncodingsOverride()
Clears accepted encodings set by setAcceptedEncodings
|
void |
clearBrowserCache()
Clears browser cache.
|
void |
clearBrowserCookies()
Clears browser cookies.
|
void |
continueInterceptedRequest(String interceptionId)
Deprecated.
|
void |
continueInterceptedRequest(String interceptionId,
ErrorReason errorReason,
String rawResponse,
String url,
String method,
String postData,
Map<String,Object> headers,
AuthChallengeResponse authChallengeResponse)
Deprecated.
|
void |
deleteCookies(String name)
Deletes browser cookies with matching name and url or domain/path pair.
|
void |
deleteCookies(String name,
String url,
String domain,
String path)
Deletes browser cookies with matching name and url or domain/path pair.
|
void |
disable()
Disables network tracking, prevents network events from being sent to the client.
|
void |
emulateNetworkConditions(Boolean offline,
Double latency,
Double downloadThroughput,
Double uploadThroughput)
Activates emulation of network conditions.
|
void |
emulateNetworkConditions(Boolean offline,
Double latency,
Double downloadThroughput,
Double uploadThroughput,
ConnectionType connectionType)
Activates emulation of network conditions.
|
void |
enable()
Enables network tracking, network events will now be delivered to the client.
|
void |
enable(Integer maxTotalBufferSize,
Integer maxResourceBufferSize,
Integer maxPostDataSize)
Enables network tracking, network events will now be delivered to the client.
|
List<Cookie> |
getAllCookies()
Returns all browser cookies.
|
List<String> |
getCertificate(String origin)
Returns the DER-encoded certificate.
|
List<Cookie> |
getCookies()
Returns all browser cookies for the current URL.
|
List<Cookie> |
getCookies(List<String> urls)
Returns all browser cookies for the current URL.
|
String |
getRequestPostData(String requestId)
Returns post data sent with the request.
|
ResponseBody |
getResponseBody(String requestId)
Returns content served for the given request.
|
ResponseBodyForInterception |
getResponseBodyForInterception(String interceptionId)
Returns content served for the given currently intercepted request.
|
SecurityIsolationStatus |
getSecurityIsolationStatus()
Returns information about the COEP/COOP isolation status.
|
SecurityIsolationStatus |
getSecurityIsolationStatus(String frameId)
Returns information about the COEP/COOP isolation status.
|
LoadNetworkResourcePageResult |
loadNetworkResource(String frameId,
String url,
LoadNetworkResourceOptions options)
Fetches the resource and returns the content.
|
EventListener |
onDataReceived(EventHandler<DataReceived> eventListener)
Fired when data chunk was received over the network.
|
EventListener |
onEventSourceMessageReceived(EventHandler<EventSourceMessageReceived> eventListener)
Fired when EventSource message is received.
|
EventListener |
onLoadingFailed(EventHandler<LoadingFailed> eventListener)
Fired when HTTP request has failed to load.
|
EventListener |
onLoadingFinished(EventHandler<LoadingFinished> eventListener)
Fired when HTTP request has finished loading.
|
EventListener |
onRequestIntercepted(EventHandler<RequestIntercepted> eventListener)
Deprecated.
|
EventListener |
onRequestServedFromCache(EventHandler<RequestServedFromCache> eventListener)
Fired if request ended up loading from cache.
|
EventListener |
onRequestWillBeSent(EventHandler<RequestWillBeSent> eventListener)
Fired when page is about to send HTTP request.
|
EventListener |
onRequestWillBeSentExtraInfo(EventHandler<RequestWillBeSentExtraInfo> eventListener)
Fired when additional information about a requestWillBeSent event is available from the network
stack.
|
EventListener |
onResourceChangedPriority(EventHandler<ResourceChangedPriority> eventListener)
Fired when resource loading priority is changed
|
EventListener |
onResponseReceived(EventHandler<ResponseReceived> eventListener)
Fired when HTTP response is available.
|
EventListener |
onResponseReceivedExtraInfo(EventHandler<ResponseReceivedExtraInfo> eventListener)
Fired when additional information about a responseReceived event is available from the network
stack.
|
EventListener |
onSignedExchangeReceived(EventHandler<SignedExchangeReceived> eventListener)
Fired when a signed exchange was received over the network
|
EventListener |
onTrustTokenOperationDone(EventHandler<TrustTokenOperationDone> eventListener)
Fired exactly once for each Trust Token operation.
|
EventListener |
onWebSocketClosed(EventHandler<WebSocketClosed> eventListener)
Fired when WebSocket is closed.
|
EventListener |
onWebSocketCreated(EventHandler<WebSocketCreated> eventListener)
Fired upon WebSocket creation.
|
EventListener |
onWebSocketFrameError(EventHandler<WebSocketFrameError> eventListener)
Fired when WebSocket message error occurs.
|
EventListener |
onWebSocketFrameReceived(EventHandler<WebSocketFrameReceived> eventListener)
Fired when WebSocket message is received.
|
EventListener |
onWebSocketFrameSent(EventHandler<WebSocketFrameSent> eventListener)
Fired when WebSocket message is sent.
|
EventListener |
onWebSocketHandshakeResponseReceived(EventHandler<WebSocketHandshakeResponseReceived> eventListener)
Fired when WebSocket handshake response becomes available.
|
EventListener |
onWebSocketWillSendHandshakeRequest(EventHandler<WebSocketWillSendHandshakeRequest> eventListener)
Fired when WebSocket is about to initiate handshake.
|
EventListener |
onWebTransportClosed(EventHandler<WebTransportClosed> eventListener)
Fired when WebTransport is disposed.
|
EventListener |
onWebTransportConnectionEstablished(EventHandler<WebTransportConnectionEstablished> eventListener)
Fired when WebTransport handshake is finished.
|
EventListener |
onWebTransportCreated(EventHandler<WebTransportCreated> eventListener)
Fired upon WebTransport creation.
|
void |
replayXHR(String requestId)
This method sends a new XMLHttpRequest which is identical to the original one.
|
List<SearchMatch> |
searchInResponseBody(String requestId,
String query)
Searches for given string in response content.
|
List<SearchMatch> |
searchInResponseBody(String requestId,
String query,
Boolean caseSensitive,
Boolean isRegex)
Searches for given string in response content.
|
void |
setAcceptedEncodings(List<ContentEncoding> encodings)
Sets a list of content encodings that will be accepted.
|
void |
setAttachDebugStack(Boolean enabled)
Specifies whether to attach a page script stack id in requests
|
void |
setBlockedURLs(List<String> urls)
Blocks URLs from loading.
|
void |
setBypassServiceWorker(Boolean bypass)
Toggles ignoring of service worker for each request.
|
void |
setCacheDisabled(Boolean cacheDisabled)
Toggles ignoring cache for each request.
|
Boolean |
setCookie(String name,
String value)
Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
|
Boolean |
setCookie(String name,
String value,
String url,
String domain,
String path,
Boolean secure,
Boolean httpOnly,
CookieSameSite sameSite,
Double expires,
CookiePriority priority,
Boolean sameParty,
CookieSourceScheme sourceScheme,
Integer sourcePort)
Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
|
void |
setCookies(List<CookieParam> cookies)
Sets given cookies.
|
void |
setDataSizeLimitsForTest(Integer maxTotalSize,
Integer maxResourceSize)
For testing.
|
void |
setExtraHTTPHeaders(Map<String,Object> headers)
Specifies whether to always send extra HTTP headers with the requests from this page.
|
void |
setRequestInterception(List<RequestPattern> patterns)
Deprecated.
|
String |
takeResponseBodyForInterceptionAsStream(String interceptionId)
Returns a handle to the stream representing the response body.
|
void setAcceptedEncodings(List<ContentEncoding> encodings)
encodings - List of accepted content encodings.void clearAcceptedEncodingsOverride()
@Deprecated Boolean canClearBrowserCache()
@Deprecated Boolean canClearBrowserCookies()
@Deprecated Boolean canEmulateNetworkConditions()
void clearBrowserCache()
void clearBrowserCookies()
@Deprecated void continueInterceptedRequest(String interceptionId)
interceptionId - @Deprecated void continueInterceptedRequest(String interceptionId, ErrorReason errorReason, String rawResponse, String url, String method, String postData, Map<String,Object> headers, AuthChallengeResponse authChallengeResponse)
interceptionId - errorReason - If set this causes the request to fail with the given reason. Passing
`Aborted` for requests marked with `isNavigationRequest` also cancels the navigation. Must
not be set in response to an authChallenge.rawResponse - If set the requests completes using with the provided base64 encoded raw
response, including HTTP status line and headers etc... Must not be set in response to an
authChallenge. (Encoded as a base64 string when passed over JSON)url - If set the request url will be modified in a way that's not observable by page. Must
not be set in response to an authChallenge.method - If set this allows the request method to be overridden. Must not be set in
response to an authChallenge.postData - If set this allows postData to be set. Must not be set in response to an
authChallenge.headers - If set this allows the request headers to be changed. Must not be set in
response to an authChallenge.authChallengeResponse - Response to a requestIntercepted with an authChallenge. Must not
be set otherwise.void deleteCookies(String name)
name - Name of the cookies to remove.void deleteCookies(String name, String url, String domain, String path)
name - Name of the cookies to remove.url - If specified, deletes all the cookies with the given name where domain and path
match provided URL.domain - If specified, deletes only cookies with the exact domain.path - If specified, deletes only cookies with the exact path.void disable()
void emulateNetworkConditions(Boolean offline, Double latency, Double downloadThroughput, Double uploadThroughput)
offline - True to emulate internet disconnection.latency - Minimum latency from request sent to response headers received (ms).downloadThroughput - Maximal aggregated download throughput (bytes/sec). -1 disables
download throttling.uploadThroughput - Maximal aggregated upload throughput (bytes/sec). -1 disables upload
throttling.void emulateNetworkConditions(Boolean offline, Double latency, Double downloadThroughput, Double uploadThroughput, ConnectionType connectionType)
offline - True to emulate internet disconnection.latency - Minimum latency from request sent to response headers received (ms).downloadThroughput - Maximal aggregated download throughput (bytes/sec). -1 disables
download throttling.uploadThroughput - Maximal aggregated upload throughput (bytes/sec). -1 disables upload
throttling.connectionType - Connection type if known.void enable()
void enable(Integer maxTotalBufferSize, Integer maxResourceBufferSize, Integer maxPostDataSize)
maxTotalBufferSize - Buffer size in bytes to use when preserving network payloads (XHRs,
etc).maxResourceBufferSize - Per-resource buffer size in bytes to use when preserving network
payloads (XHRs, etc).maxPostDataSize - Longest post body size (in bytes) that would be included in
requestWillBeSent notificationList<Cookie> getAllCookies()
List<String> getCertificate(String origin)
origin - Origin to get certificate for.List<Cookie> getCookies()
List<Cookie> getCookies(List<String> urls)
urls - 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.ResponseBody getResponseBody(String requestId)
requestId - Identifier of the network request to get content for.String getRequestPostData(String requestId)
requestId - Identifier of the network request to get content for.ResponseBodyForInterception getResponseBodyForInterception(String interceptionId)
interceptionId - Identifier for the intercepted request to get body for.String takeResponseBodyForInterceptionAsStream(String interceptionId)
interceptionId - void replayXHR(String requestId)
requestId - Identifier of XHR to replay.List<SearchMatch> searchInResponseBody(String requestId, String query)
requestId - Identifier of the network response to search.query - String to search for.List<SearchMatch> searchInResponseBody(String requestId, String query, Boolean caseSensitive, Boolean isRegex)
requestId - Identifier of the network response to search.query - String to search for.caseSensitive - If true, search is case sensitive.isRegex - If true, treats string parameter as regex.void setBlockedURLs(List<String> urls)
urls - URL patterns to block. Wildcards ('*') are allowed.void setBypassServiceWorker(Boolean bypass)
bypass - Bypass service worker and load from network.void setCacheDisabled(Boolean cacheDisabled)
cacheDisabled - Cache disabled state.Boolean setCookie(String name, String value)
name - Cookie name.value - Cookie value.Boolean setCookie(String name, String value, String url, String domain, String path, Boolean secure, Boolean httpOnly, CookieSameSite sameSite, Double expires, CookiePriority priority, Boolean sameParty, CookieSourceScheme sourceScheme, Integer sourcePort)
name - Cookie name.value - Cookie value.url - 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 - Cookie domain.path - Cookie path.secure - True if cookie is secure.httpOnly - True if cookie is http-only.sameSite - Cookie SameSite type.expires - Cookie expiration date, session cookie if not setpriority - Cookie Priority type.sameParty - True if cookie is SameParty.sourceScheme - Cookie source scheme type.sourcePort - 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.void setCookies(List<CookieParam> cookies)
cookies - Cookies to be set.void setDataSizeLimitsForTest(Integer maxTotalSize, Integer maxResourceSize)
maxTotalSize - Maximum total buffer size.maxResourceSize - Maximum per-resource size.void setExtraHTTPHeaders(Map<String,Object> headers)
headers - Map with extra HTTP headers.void setAttachDebugStack(Boolean enabled)
enabled - Whether to attach a page script stack for debugging purpose.@Deprecated void setRequestInterception(List<RequestPattern> patterns)
patterns - Requests matching any of these patterns will be forwarded and wait for the
corresponding continueInterceptedRequest call.SecurityIsolationStatus getSecurityIsolationStatus()
SecurityIsolationStatus getSecurityIsolationStatus(String frameId)
frameId - If no frameId is provided, the status of the target is provided.LoadNetworkResourcePageResult loadNetworkResource(String frameId, String url, LoadNetworkResourceOptions options)
frameId - Frame id to get the resource for.url - URL of the resource to get content for.options - Options for the request.EventListener onDataReceived(EventHandler<DataReceived> eventListener)
EventListener onEventSourceMessageReceived(EventHandler<EventSourceMessageReceived> eventListener)
EventListener onLoadingFailed(EventHandler<LoadingFailed> eventListener)
EventListener onLoadingFinished(EventHandler<LoadingFinished> eventListener)
@Deprecated EventListener onRequestIntercepted(EventHandler<RequestIntercepted> eventListener)
EventListener onRequestServedFromCache(EventHandler<RequestServedFromCache> eventListener)
EventListener onRequestWillBeSent(EventHandler<RequestWillBeSent> eventListener)
EventListener onResourceChangedPriority(EventHandler<ResourceChangedPriority> eventListener)
EventListener onSignedExchangeReceived(EventHandler<SignedExchangeReceived> eventListener)
EventListener onResponseReceived(EventHandler<ResponseReceived> eventListener)
EventListener onWebSocketClosed(EventHandler<WebSocketClosed> eventListener)
EventListener onWebSocketCreated(EventHandler<WebSocketCreated> eventListener)
EventListener onWebSocketFrameError(EventHandler<WebSocketFrameError> eventListener)
EventListener onWebSocketFrameReceived(EventHandler<WebSocketFrameReceived> eventListener)
EventListener onWebSocketFrameSent(EventHandler<WebSocketFrameSent> eventListener)
EventListener onWebSocketHandshakeResponseReceived(EventHandler<WebSocketHandshakeResponseReceived> eventListener)
EventListener onWebSocketWillSendHandshakeRequest(EventHandler<WebSocketWillSendHandshakeRequest> eventListener)
EventListener onWebTransportCreated(EventHandler<WebTransportCreated> eventListener)
EventListener onWebTransportConnectionEstablished(EventHandler<WebTransportConnectionEstablished> eventListener)
EventListener onWebTransportClosed(EventHandler<WebTransportClosed> eventListener)
EventListener onRequestWillBeSentExtraInfo(EventHandler<RequestWillBeSentExtraInfo> eventListener)
EventListener onResponseReceivedExtraInfo(EventHandler<ResponseReceivedExtraInfo> eventListener)
EventListener onTrustTokenOperationDone(EventHandler<TrustTokenOperationDone> eventListener)
Copyright © 2021 Kenan Klisura. All rights reserved.