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 |
deleteCookie(String cookieName,
String url)
Deletes browser cookie with given name, domain and path.
|
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 url,
String name,
String value)
Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
|
Boolean |
setCookie(String url,
String name,
String value,
String domain,
String path,
Boolean secure,
Boolean httpOnly,
CookieSameSite sameSite,
Double expirationDate)
Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
|
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 |
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 deleteCookie(String cookieName, String url)
cookieName
- Name of the cookie to remove.url
- URL to match cooke domain and path.Boolean setCookie(String url, String name, String value, String domain, String path, Boolean secure, Boolean httpOnly, CookieSameSite sameSite, Double expirationDate)
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.name
- The name of the cookie.value
- The value of the cookie.domain
- If omitted, the cookie becomes a host-only cookie.path
- Defaults to the path portion of the url parameter.secure
- Defaults ot false.httpOnly
- Defaults to false.sameSite
- Defaults to browser default behavior.expirationDate
- If omitted, the cookie becomes a session cookie.Boolean canEmulateNetworkConditions()
void emulateNetworkConditions(Boolean offline, Double latency, Double downloadThroughput, Double uploadThroughput, ConnectionType connectionType)
offline
- True to emulate internet disconnection.latency
- Additional latency (ms).downloadThroughput
- Maximal aggregated download throughput.uploadThroughput
- Maximal aggregated upload throughput.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 enable()
List<Cookie> getCookies()
Boolean setCookie(String url, String name, String 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.name
- The name of the cookie.value
- The value of the cookie.void emulateNetworkConditions(Boolean offline, Double latency, Double downloadThroughput, Double uploadThroughput)
offline
- True to emulate internet disconnection.latency
- Additional latency (ms).downloadThroughput
- Maximal aggregated download throughput.uploadThroughput
- Maximal aggregated upload throughput.Copyright © 2017 WebFolder OÜ. All rights reserved.