public interface Network
Modifier and Type | Method | 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,
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.
|
byte[] |
getRequestPostData(String requestId) |
Returns post data sent with the request.
|
GetResponseBodyResult |
getResponseBody(String requestId) |
Returns content served for the given request.
|
GetResponseBodyForInterceptionResult |
getResponseBodyForInterception(String interceptionId) |
Returns content served for the given currently intercepted request.
|
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 |
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.
|
String |
takeResponseBodyForInterceptionAsStream(String interceptionId) |
Returns a handle to the stream representing the response body.
|
Boolean canClearBrowserCache()
Boolean canClearBrowserCookies()
Boolean canEmulateNetworkConditions()
void clearBrowserCache()
void clearBrowserCookies()
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 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, 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(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()
cookies
field.List<String> getCertificate(String origin)
origin
- Origin to get certificate for.List<Cookie> getCookies(List<String> urls)
cookies
field.urls
- The list of URLs for which applicable cookies will be fetchedGetResponseBodyResult getResponseBody(String requestId)
requestId
- Identifier of the network request to get content for.byte[] getRequestPostData(String requestId)
requestId
- Identifier of the network request to get content for.GetResponseBodyForInterceptionResult getResponseBodyForInterception(String interceptionId)
interceptionId
- Identifier for the intercepted request to get body for.String takeResponseBodyForInterceptionAsStream(String interceptionId)
void replayXHR(String requestId)
requestId
- Identifier of XHR to replay.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)
true
, cache will not be used.cacheDisabled
- Cache disabled state.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.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 setRequestInterception(List<RequestPattern> patterns)
patterns
- Requests matching any of these patterns will be forwarded and wait for the corresponding
continueInterceptedRequest call.void setUserAgentOverride(String userAgent)
userAgent
- User agent to use.void continueInterceptedRequest(String interceptionId)
void deleteCookies(String name)
name
- Name of the cookies to remove.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 enable()
List<Cookie> getCookies()
cookies
field.List<SearchMatch> searchInResponseBody(String requestId, String query)
requestId
- Identifier of the network response to search.query
- String to search for.Copyright © 2017, 2018–2018 WebFolder OÜ. All rights reserved.