public interface Network
Modifier and Type | Method and Description |
---|---|
Boolean |
canClearBrowserCache()
Tells whether clearing browser cache is supported.
|
Boolean |
canClearBrowserCookies()
Tells whether clearing browser cookies is supported.
|
Boolean |
canEmulateNetworkConditions()
Tells whether emulation of network conditions is supported.
|
void |
clearBrowserCache()
Clears browser cache.
|
void |
clearBrowserCookies()
Clears browser cookies.
|
void |
continueInterceptedRequest(String interceptionId)
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.
|
void |
continueInterceptedRequest(String interceptionId,
ErrorReason errorReason,
String rawResponse,
String url,
String method,
String postData,
Map<String,Object> headers,
AuthChallengeResponse authChallengeResponse)
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.
|
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)
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.
|
GetResponseBodyResult |
getResponseBody(String requestId)
Returns content served for the given request.
|
void |
replayXHR(String requestId)
This method sends a new XMLHttpRequest which is identical to the original one.
|
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)
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)
Sets the requests to intercept that match a the provided patterns and optionally resource types.
|
void |
setUserAgentOverride(String userAgent)
Allows overriding user agent with the given string.
|
void enable(Integer maxTotalBufferSize, Integer maxResourceBufferSize)
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).void disable()
void setUserAgentOverride(String userAgent)
userAgent
- User agent to use.void setExtraHTTPHeaders(Map<String,Object> headers)
headers
- Map with extra HTTP headers.GetResponseBodyResult getResponseBody(String requestId)
requestId
- Identifier of the network request to get content for.void setBlockedURLs(List<String> urls)
urls
- URL patterns to block. Wildcards ('*') are allowed.void replayXHR(String requestId)
requestId
- Identifier of XHR to replay.Boolean canClearBrowserCache()
void clearBrowserCache()
Boolean canClearBrowserCookies()
void clearBrowserCookies()
List<Cookie> getCookies(List<String> urls)
urls
- The list of URLs for which applicable cookies will be fetchedList<Cookie> getAllCookies()
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.Boolean setCookie(String name, String value, String url, String domain, String path, Boolean secure, Boolean httpOnly, CookieSameSite sameSite, Double expires)
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 and path 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 setvoid setCookies(List<CookieParam> cookies)
cookies
- Cookies to be set.Boolean canEmulateNetworkConditions()
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 setCacheDisabled(Boolean cacheDisabled)
cacheDisabled
- Cache disabled state.void setBypassServiceWorker(Boolean bypass)
bypass
- Bypass service worker and load from network.void setDataSizeLimitsForTest(Integer maxTotalSize, Integer maxResourceSize)
maxTotalSize
- Maximum total buffer size.maxResourceSize
- Maximum per-resource size.List<String> getCertificate(String origin)
origin
- Origin to get certificate for.void setRequestInterception(List<RequestPattern> patterns)
patterns
- Requests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call.void continueInterceptedRequest(String interceptionId, ErrorReason errorReason, String rawResponse, String url, String method, String postData, Map<String,Object> headers, AuthChallengeResponse authChallengeResponse)
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.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 enable()
List<Cookie> getCookies()
void deleteCookies(String name)
name
- Name of the cookies to remove.Boolean setCookie(String name, String value)
name
- Cookie name.value
- Cookie value.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 continueInterceptedRequest(String interceptionId)
Copyright © 2017 WebFolder OÜ. All rights reserved.