Package Torello.Browser
Class Network
- java.lang.Object
-
- Torello.Browser.Network
-
public class Network extends java.lang.Object
Class created byAutomatic Code-Generator
.
This class was built using the Chrome Remote Dev-Tools A.P.I., which is specified by two JSON-RPC Files. These files were obtained from the Chrome Dev Tools Protocol Git Hub Page, which has a "Tip of Tree" (the latest) API-Specification Page Here: JSON-RPC Protocol Specification.
JSON-Viewable Google-API:
These files may be viewed here: browser_protocol.json and js_protocol.json.
These files were converted into this Java-Browser (CDT) Library; they are a Java-Alternative to the Node.js implementation.
HTML-Viewable API:
In addition to this Class-Library, these files were also converted to a simple HTML Page, which may be browsed here: Browser API Web-PageNode.js
RDP-API Implementation:
You may read about theNode.js Chrome Remote Interface
on the Node.js Package Manager Web-Site: NPM
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.This class is intended to be used with a Headless Browser
These methods have been tested, to some degree, using Google Chrome. In order to use this class you must start a web-browser instance and make a connection to the browser using aRemote Debugging Port
. The initializations may be accomplished using classBRDPC
(Browser Remote Debug Protocol Connection).
Google-Chrome was used during the development process of the classes in this particular package. Note that, lately, it has been asserted Microsoft has switched to using the Chrome-Engine for its Microsoft Edge Browser Internal Code-Base. Therefore, there may limited support / functionality when running the methods in this class with Microsoft-Edge. There is the possibility these will work with Opera & Safari.
Check whether the your Web-Browser will allow itself to be driven by theWeb-Socket RDP-Port 9223
.
Foreign Function API:
Every one of the methods that reside in this class are designed to do nothing more than:- Accept Parameters from the User, and "Marshall Them" into a Valid JSON-Request
- Transmit the Marshalled Request-JSON to a Headless Web-Browser over a Web-Socket RDP Connection
- Receive BOTH that Method's Results AND any Browser Event-Firings from the Web-Socket
- Parse JSON Method-Results and Browser-Event Firings, and Subsequently Convert them to Standard Java-Types
- Report these Method-Results and Browser-Events to the User via an User-Registered Event-Listener or a Promise Object
Java-HTML Difference:
Unlike the bulk of the Java HTML JAR Library, there is very little native Java-Code, and very little testing that may be done on any of the classes & methods in this package. The code inside these classes does nothing more than marshall-and-unmarshall Java-Types into Json-Requests (and vice-versa). The Java-Script & Browser modules inside of a Google-Chrome instance are, theoretically, handling these requests, and returning their results (or events) over the Web-Socket Connection.
It has been asserted (by Google Chrome Developers) that some of these methods are only "partially working" or "experimental".
Hi-Lited Source-Code:- View Here: Torello/Browser/Network.java
- Open New Browser-Tab: Torello/Browser/Network.java
File Size: 381,444 Bytes Line Count: 9,264 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctional
Annotation may also be called 'The Spaghetti Report'.Static-Functional
classes are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@Stateless
Annotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 33 Method(s), 33 declared static
- 27 Field(s), 27 declared static, 26 declared final
- Fields excused from final modifier (with explanation):
Field 'counter' is not final. Reason: CONFIGURATION
-
-
Nested Class Summary
Type Classes: Network Domain Types Modifier and Type Inner-Class static class
Network.AuthChallenge
Authorization challenge for HTTP status code 401 or 407.static class
Network.AuthChallengeResponse
Response to an AuthChallenge.static class
Network.BlockedCookieWithReason
A cookie with was not sent with a request with the corresponding reason.static class
Network.BlockedSetCookieWithReason
A cookie which was not stored from a response with the corresponding reason.static class
Network.CachedResource
Information about the cached resource.static class
Network.ClientSecurityState
[No Description Provided by Google]
EXPERIMENTALstatic class
Network.ConnectTiming
[No Description Provided by Google]
EXPERIMENTALstatic class
Network.Cookie
Cookie objectstatic class
Network.CookieParam
Cookie parameter objectstatic class
Network.CorsErrorStatus
[No Description Provided by Google]
static class
Network.CrossOriginEmbedderPolicyStatus
[No Description Provided by Google]
EXPERIMENTALstatic class
Network.CrossOriginOpenerPolicyStatus
[No Description Provided by Google]
EXPERIMENTALstatic class
Network.Initiator
Information about the request initiator.static class
Network.LoadNetworkResourceOptions
An options object that may be extended later to better support CORS, CORB and streaming.static class
Network.LoadNetworkResourcePageResult
An object providing the result of a network resource load.static class
Network.PostDataEntry
Post data entry for HTTP requeststatic class
Network.ReportingApiReport
An object representing a report generated by the Reporting API.static class
Network.Request
HTTP request data.static class
Network.RequestPattern
Request pattern for interception.static class
Network.ResourceTiming
Timing information for the request.static class
Network.Response
HTTP response data.static class
Network.SecurityDetails
Security details about a request.static class
Network.SecurityIsolationStatus
[No Description Provided by Google]
EXPERIMENTALstatic class
Network.SignedCertificateTimestamp
Details of a signed certificate timestamp (SCT).static class
Network.SignedExchangeError
Information about a signed exchange response.static class
Network.SignedExchangeHeader
Information about a signed exchange header.static class
Network.SignedExchangeInfo
Information about a signed exchange response.static class
Network.SignedExchangeSignature
Information about a signed exchange signature.static class
Network.TrustTokenParams
Determines what type of Trust Token operation is executed and depending on the type, some additional parameters.static class
Network.WebSocketFrame
WebSocket message data.static class
Network.WebSocketRequest
WebSocket request data.static class
Network.WebSocketResponse
WebSocket response data.Event Classes: Network Domain Events Modifier and Type Inner-Class static class
Network.dataReceived
Fired when data chunk was received over the network.static class
Network.eventSourceMessageReceived
Fired when EventSource message is received.static class
Network.loadingFailed
Fired when HTTP request has failed to load.static class
Network.loadingFinished
Fired when HTTP request has finished loading.static class
Network.reportingApiReportAdded
Is sent whenever a new report is added.static class
Network.reportingApiReportUpdated
[No Description Provided by Google]
EXPERIMENTALstatic class
Network.requestIntercepted
Details of an intercepted HTTP request, which must be either allowed, blocked, modified or mocked.static class
Network.requestServedFromCache
Fired if request ended up loading from cache.static class
Network.requestWillBeSent
Fired when page is about to send HTTP request.static class
Network.requestWillBeSentExtraInfo
Fired when additional information about a requestWillBeSent event is available from the network stack.static class
Network.resourceChangedPriority
Fired when resource loading priority is changed
EXPERIMENTALstatic class
Network.responseReceived
Fired when HTTP response is available.static class
Network.responseReceivedExtraInfo
Fired when additional information about a responseReceived event is available from the network stack.static class
Network.signedExchangeReceived
Fired when a signed exchange was received over the network
EXPERIMENTALstatic class
Network.subresourceWebBundleInnerResponseError
Fired when request for resources within a .wbn file failed.static class
Network.subresourceWebBundleInnerResponseParsed
Fired when handling requests for resources within a .wbn file.static class
Network.subresourceWebBundleMetadataError
Fired once when parsing the .wbn file has failed.static class
Network.subresourceWebBundleMetadataReceived
Fired once when parsing the .wbn file has succeeded.static class
Network.trustTokenOperationDone
Fired exactly once for each Trust Token operation.static class
Network.webSocketClosed
Fired when WebSocket is closed.static class
Network.webSocketCreated
Fired upon WebSocket creation.static class
Network.webSocketFrameError
Fired when WebSocket message error occurs.static class
Network.webSocketFrameReceived
Fired when WebSocket message is received.static class
Network.webSocketFrameSent
Fired when WebSocket message is sent.static class
Network.webSocketHandshakeResponseReceived
Fired when WebSocket handshake response becomes available.static class
Network.webSocketWillSendHandshakeRequest
Fired when WebSocket is about to initiate handshake.static class
Network.webTransportClosed
Fired when WebTransport is disposed.static class
Network.webTransportConnectionEstablished
Fired when WebTransport handshake is finished.static class
Network.webTransportCreated
Fired upon WebTransport creation.
-
Field Summary
Network Domain Enumerated String Types Modifier and Type Field static String[]
BlockedReason
The reason why request was blocked.static String[]
CertificateTransparencyCompliance
Whether the request complied with Certificate Transparency policy.static String[]
ConnectionType
The underlying connection technology that the browser is supposedly using.static String[]
ContentEncoding
List of content encodings supported by the backend.static String[]
CookieBlockedReason
Types of reasons why a cookie may not be sent with a request.static String[]
CookiePriority
Represents the cookie's 'Priority' status: https://tools.ietf.org/html/draft-west-cookie-priority-00
EXPERIMENTALstatic String[]
CookieSameSite
Represents the cookie's 'SameSite' status: https://tools.ietf.org/html/draft-west-first-party-cookiesstatic String[]
CookieSourceScheme
Represents the source scheme of the origin that originally set the cookie.static String[]
CorsError
The reason why request was blocked.static String[]
CrossOriginEmbedderPolicyValue
[No Description Provided by Google]
EXPERIMENTALstatic String[]
CrossOriginOpenerPolicyValue
[No Description Provided by Google]
EXPERIMENTALstatic String[]
ErrorReason
Network level fetch failure reason.static String[]
InterceptionStage
Stages of the interception to begin intercepting.static String[]
IPAddressSpace
[No Description Provided by Google]
EXPERIMENTALstatic String[]
PrivateNetworkRequestPolicy
[No Description Provided by Google]
EXPERIMENTALstatic String[]
ReportStatus
The status of a Reporting API report.static String[]
ResourcePriority
Loading priority of a resource request.static String[]
ResourceType
Resource type as it was perceived by the rendering engine.static String[]
ServiceWorkerResponseSource
Source of serviceworker response.static String[]
SetCookieBlockedReason
Types of reasons why a cookie may not be stored from a response.static String[]
SignedExchangeErrorField
Field type for a signed exchange related error.static String[]
TrustTokenOperationType
[No Description Provided by Google]
EXPERIMENTAL
-
Method Summary
Network Domain Commands Script Returns Modifier and Type Method Boolean
static Script<>
canClearBrowserCache()
Tells whether clearing browser cache is supported.Boolean
static Script<>
canClearBrowserCookies()
Tells whether clearing browser cookies is supported.Boolean
static Script<>
canEmulateNetworkConditions()
Tells whether emulation of network conditions is supported.NONE ( void
)static Script<>
clearAcceptedEncodingsOverride()
Clears accepted encodings set by setAcceptedEncodings
EXPERIMENTALNONE ( void
)static Script<>
clearBrowserCache()
Clears browser cache.NONE ( void
)static Script<>
clearBrowserCookies()
Clears browser cookies.NONE ( void
)static Script<>
continueInterceptedRequest(String interceptionId, String errorReason, String rawResponse, String url, String method, String postData, JsonObject headers, Network.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.NONE ( void
)static Script<>
deleteCookies(String name, String url, String domain, String path)
Deletes browser cookies with matching name and url or domain/path pair.NONE ( void
)static Script<>
disable()
Disables network tracking, prevents network events from being sent to the client.NONE ( void
)static Script<>
emulateNetworkConditions(boolean offline, Number latency, Number downloadThroughput, Number uploadThroughput, String connectionType)
Activates emulation of network conditions.NONE ( void
)static Script<>
enable(Integer maxTotalBufferSize, Integer maxResourceBufferSize, Integer maxPostDataSize)
Enables network tracking, network events will now be delivered to the client.NONE ( void
)static Script<>
enableReportingApi(boolean enable)
Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client.Network.Cookie[]
static Script<>
getAllCookies()
Returns all browser cookies.String[]
static Script<>
getCertificate(String origin)
Returns the DER-encoded certificate.Network.Cookie[]
static Script<>
getCookies(String[] urls)
Returns all browser cookies for the current URL.String
static Script<>
getRequestPostData(String requestId)
Returns post data sent with the request.Ret2<String,
Boolean>static Script<>
getResponseBody(String requestId)
Returns content served for the given request.Ret2<String,
Boolean>static Script<>
getResponseBodyForInterception(String interceptionId)
Returns content served for the given currently intercepted request.Network.SecurityIsolationStatus
static Script<>
getSecurityIsolationStatus(String frameId)
Returns information about the COEP/COOP isolation status.Network.LoadNetworkResourcePageResult
static Script<>
loadNetworkResource(String frameId, String url, Network.LoadNetworkResourceOptions options)
Fetches the resource and returns the content.NONE ( void
)static Script<>
replayXHR(String requestId)
This method sends a new XMLHttpRequest which is identical to the original one.Debugger.SearchMatch[]
static Script<>
searchInResponseBody(String requestId, String query, Boolean caseSensitive, Boolean isRegex)
Searches for given string in response content.NONE ( void
)static Script<>
setAcceptedEncodings(String[] encodings)
Sets a list of content encodings that will be accepted.NONE ( void
)static Script<>
setAttachDebugStack(boolean enabled)
Specifies whether to attach a page script stack id in requests
EXPERIMENTALNONE ( void
)static Script<>
setBlockedURLs(String[] urls)
Blocks URLs from loading.NONE ( void
)static Script<>
setBypassServiceWorker(boolean bypass)
Toggles ignoring of service worker for each request.NONE ( void
)static Script<>
setCacheDisabled(boolean cacheDisabled)
Toggles ignoring cache for each request.Boolean
static Script<>
setCookie(String name, String value, String url, String domain, String path, Boolean secure, Boolean httpOnly, String sameSite, Number expires, String priority, Boolean sameParty, String sourceScheme, Integer sourcePort)
Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.NONE ( void
)static Script<>
setCookies(Network.CookieParam[] cookies)
Sets given cookies.NONE ( void
)static Script<>
setExtraHTTPHeaders(JsonObject headers)
Specifies whether to always send extra HTTP headers with the requests from this page.NONE ( void
)static Script<>
setRequestInterception(Network.RequestPattern[] patterns)
Sets the requests to intercept that match the provided patterns and optionally resource types.NONE ( void
)static Script<>
setUserAgentOverride(String userAgent, String acceptLanguage, String platform, Emulation.UserAgentMetadata userAgentMetadata)
Allows overriding user agent with the given string.String
static Script<>
takeResponseBodyForInterceptionAsStream(String interceptionId)
Returns a handle to the stream representing the response body.
-
-
-
Field Detail
-
ResourceType
public static final java.lang.String[] ResourceType
Resource type as it was perceived by the rendering engine.
-
ErrorReason
public static final java.lang.String[] ErrorReason
Network level fetch failure reason.
-
ConnectionType
public static final java.lang.String[] ConnectionType
The underlying connection technology that the browser is supposedly using.
-
CookieSameSite
public static final java.lang.String[] CookieSameSite
Represents the cookie's 'SameSite' status: https://tools.ietf.org/html/draft-west-first-party-cookies
-
CookiePriority
public static final java.lang.String[] CookiePriority
Represents the cookie's 'Priority' status: https://tools.ietf.org/html/draft-west-cookie-priority-00
EXPERIMENTAL
-
CookieSourceScheme
public static final java.lang.String[] CookieSourceScheme
Represents the source scheme of the origin that originally set the cookie. A value of "Unset" allows protocol clients to emulate legacy cookie scope for the scheme. This is a temporary ability and it will be removed in the future.
EXPERIMENTAL
-
ResourcePriority
public static final java.lang.String[] ResourcePriority
Loading priority of a resource request.
-
CertificateTransparencyCompliance
public static final java.lang.String[] CertificateTransparencyCompliance
Whether the request complied with Certificate Transparency policy.
-
BlockedReason
public static final java.lang.String[] BlockedReason
The reason why request was blocked.
-
CorsError
public static final java.lang.String[] CorsError
The reason why request was blocked.
-
ServiceWorkerResponseSource
public static final java.lang.String[] ServiceWorkerResponseSource
Source of serviceworker response.
-
TrustTokenOperationType
public static final java.lang.String[] TrustTokenOperationType
[No Description Provided by Google]
EXPERIMENTAL
-
SetCookieBlockedReason
public static final java.lang.String[] SetCookieBlockedReason
Types of reasons why a cookie may not be stored from a response.
EXPERIMENTAL
-
CookieBlockedReason
public static final java.lang.String[] CookieBlockedReason
Types of reasons why a cookie may not be sent with a request.
EXPERIMENTAL
-
InterceptionStage
public static final java.lang.String[] InterceptionStage
Stages of the interception to begin intercepting. Request will intercept before the request is sent. Response will intercept after the response is received.
EXPERIMENTAL
-
SignedExchangeErrorField
public static final java.lang.String[] SignedExchangeErrorField
Field type for a signed exchange related error.
EXPERIMENTAL
-
ContentEncoding
public static final java.lang.String[] ContentEncoding
List of content encodings supported by the backend.
EXPERIMENTAL
-
PrivateNetworkRequestPolicy
public static final java.lang.String[] PrivateNetworkRequestPolicy
[No Description Provided by Google]
EXPERIMENTAL
-
IPAddressSpace
public static final java.lang.String[] IPAddressSpace
[No Description Provided by Google]
EXPERIMENTAL
-
CrossOriginOpenerPolicyValue
public static final java.lang.String[] CrossOriginOpenerPolicyValue
[No Description Provided by Google]
EXPERIMENTAL
-
CrossOriginEmbedderPolicyValue
public static final java.lang.String[] CrossOriginEmbedderPolicyValue
[No Description Provided by Google]
EXPERIMENTAL
-
ReportStatus
public static final java.lang.String[] ReportStatus
The status of a Reporting API report.
EXPERIMENTAL
-
-
Method Detail
-
setAcceptedEncodings
public static Script<java.lang.String,JsonObject,Ret0> setAcceptedEncodings (java.lang.String[] encodings)
Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted.
EXPERIMENTAL- Parameters:
encodings
- List of accepted content encodings.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
clearAcceptedEncodingsOverride
public static Script<java.lang.String,JsonObject,Ret0> clearAcceptedEncodingsOverride ()
Clears accepted encodings set by setAcceptedEncodings
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
canClearBrowserCache
public static Script<java.lang.String,JsonObject,java.lang.Boolean> canClearBrowserCache ()
Tells whether clearing browser cache is supported.
DEPRECATED- Returns:
- An instance of
Script
<String,JsonObject
, Boolean>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, Boolean>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsBoolean (result
)
True if browser cache can be cleared.
-
canClearBrowserCookies
public static Script<java.lang.String,JsonObject,java.lang.Boolean> canClearBrowserCookies ()
Tells whether clearing browser cookies is supported.
DEPRECATED- Returns:
- An instance of
Script
<String,JsonObject
, Boolean>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, Boolean>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsBoolean (result
)
True if browser cookies can be cleared.
-
canEmulateNetworkConditions
public static Script<java.lang.String,JsonObject,java.lang.Boolean> canEmulateNetworkConditions ()
Tells whether emulation of network conditions is supported.
DEPRECATED- Returns:
- An instance of
Script
<String,JsonObject
, Boolean>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, Boolean>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsBoolean (result
)
True if emulation of network conditions is supported.
-
clearBrowserCache
public static Script<java.lang.String,JsonObject,Ret0> clearBrowserCache ()
Clears browser cache.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
clearBrowserCookies
public static Script<java.lang.String,JsonObject,Ret0> clearBrowserCookies ()
Clears browser cookies.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
continueInterceptedRequest
public static Script<java.lang.String,JsonObject,Ret0> continueInterceptedRequest (java.lang.String interceptionId, java.lang.String errorReason, java.lang.String rawResponse, java.lang.String url, java.lang.String method, java.lang.String postData, JsonObject headers, Network.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. 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.
EXPERIMENTAL
DEPRECATED- Parameters:
interceptionId
- -errorReason
- If set this causes the request to fail with the given reason. PassingAborted
for requests marked withisNavigationRequest
also cancels the navigation. Must not be set in response to an authChallenge.
OPTIONALrawResponse
- 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)
OPTIONALurl
- 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.
OPTIONALmethod
- If set this allows the request method to be overridden. Must not be set in response to an authChallenge.
OPTIONALpostData
- If set this allows postData to be set. Must not be set in response to an authChallenge.
OPTIONALheaders
- If set this allows the request headers to be changed. Must not be set in response to an authChallenge.
OPTIONALauthChallengeResponse
- Response to a requestIntercepted with an authChallenge. Must not be set otherwise.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
deleteCookies
public static Script<java.lang.String,JsonObject,Ret0> deleteCookies (java.lang.String name, java.lang.String url, java.lang.String domain, java.lang.String path)
Deletes browser cookies with matching name and url or domain/path pair.- Parameters:
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.
OPTIONALdomain
- If specified, deletes only cookies with the exact domain.
OPTIONALpath
- If specified, deletes only cookies with the exact path.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
disable
public static Script<java.lang.String,JsonObject,Ret0> disable()
Disables network tracking, prevents network events from being sent to the client.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
emulateNetworkConditions
public static Script<java.lang.String,JsonObject,Ret0> emulateNetworkConditions (boolean offline, java.lang.Number latency, java.lang.Number downloadThroughput, java.lang.Number uploadThroughput, java.lang.String connectionType)
Activates emulation of network conditions.- Parameters:
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.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
enable
public static Script<java.lang.String,JsonObject,Ret0> enable (java.lang.Integer maxTotalBufferSize, java.lang.Integer maxResourceBufferSize, java.lang.Integer maxPostDataSize)
Enables network tracking, network events will now be delivered to the client.- Parameters:
maxTotalBufferSize
- Buffer size in bytes to use when preserving network payloads (XHRs, etc).
OPTIONAL
EXPERIMENTALmaxResourceBufferSize
- Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
OPTIONAL
EXPERIMENTALmaxPostDataSize
- Longest post body size (in bytes) that would be included in requestWillBeSent notification
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
getAllCookies
public static Script<java.lang.String,JsonObject,Network.Cookie[]> getAllCookies ()
Returns all browser cookies. Depending on the backend support, will return detailed cookie information in thecookies
field.- Returns:
- An instance of
Script
<String,JsonObject
,Network.Cookie
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Network.Cookie
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Network.Cookie
[] (cookies
Array of cookie objects.
-
getCertificate
public static Script<java.lang.String,JsonObject,java.lang.String[]> getCertificate (java.lang.String origin)
Returns the DER-encoded certificate.
EXPERIMENTAL- Parameters:
origin
- Origin to get certificate for.- Returns:
- An instance of
Script
<String,JsonObject
, String[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String[]>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString[] (tableNames
)
-
-
getCookies
public static Script<java.lang.String,JsonObject,Network.Cookie[]> getCookies (java.lang.String[] urls)
Returns all browser cookies for the current URL. Depending on the backend support, will return detailed cookie information in thecookies
field.- Parameters:
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.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Network.Cookie
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Network.Cookie
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Network.Cookie
[] (cookies
Array of cookie objects.
-
getResponseBody
public static Script<java.lang.String,JsonObject,Ret2<java.lang.String,java.lang.Boolean>> getResponseBody (java.lang.String requestId)
Returns content served for the given request.- Parameters:
requestId
- Identifier of the network request to get content for.- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a: String (body)
Response body.Ret2.b: Boolean (base64Encoded)
True, if content was sent as base64.
-
getRequestPostData
public static Script<java.lang.String,JsonObject,java.lang.String> getRequestPostData (java.lang.String requestId)
Returns post data sent with the request. Returns an error when no data was sent with the request.- Parameters:
requestId
- Identifier of the network request to get content for.- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (postData
)
Request body string, omitting files from multipart requests
-
getResponseBodyForInterception
public static Script<java.lang.String,JsonObject,Ret2<java.lang.String,java.lang.Boolean>> getResponseBodyForInterception (java.lang.String interceptionId)
Returns content served for the given currently intercepted request.
EXPERIMENTAL- Parameters:
interceptionId
- Identifier for the intercepted request to get body for.- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a: String (body)
Response body.Ret2.b: Boolean (base64Encoded)
True, if content was sent as base64.
-
takeResponseBodyForInterceptionAsStream
public static Script<java.lang.String,JsonObject,java.lang.String> takeResponseBodyForInterceptionAsStream (java.lang.String 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.
EXPERIMENTAL- Parameters:
interceptionId
- -- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (stream
)
-
-
replayXHR
public static Script<java.lang.String,JsonObject,Ret0> replayXHR (java.lang.String requestId)
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.
EXPERIMENTAL- Parameters:
requestId
- Identifier of XHR to replay.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
searchInResponseBody
public static Script<java.lang.String,JsonObject,Debugger.SearchMatch[]> searchInResponseBody (java.lang.String requestId, java.lang.String query, java.lang.Boolean caseSensitive, java.lang.Boolean isRegex)
Searches for given string in response content.
EXPERIMENTAL- Parameters:
requestId
- Identifier of the network response to search.query
- String to search for.caseSensitive
- If true, search is case sensitive.
OPTIONALisRegex
- If true, treats string parameter as regex.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Debugger.SearchMatch
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Debugger.SearchMatch
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Debugger.SearchMatch
[] (result
List of search matches.
-
setBlockedURLs
public static Script<java.lang.String,JsonObject,Ret0> setBlockedURLs (java.lang.String[] urls)
Blocks URLs from loading.
EXPERIMENTAL- Parameters:
urls
- URL patterns to block. Wildcards ('*') are allowed.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setBypassServiceWorker
public static Script<java.lang.String,JsonObject,Ret0> setBypassServiceWorker (boolean bypass)
Toggles ignoring of service worker for each request.
EXPERIMENTAL- Parameters:
bypass
- Bypass service worker and load from network.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setCacheDisabled
public static Script<java.lang.String,JsonObject,Ret0> setCacheDisabled (boolean cacheDisabled)
Toggles ignoring cache for each request. Iftrue
, cache will not be used.- Parameters:
cacheDisabled
- Cache disabled state.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setCookie
public static Script<java.lang.String,JsonObject,java.lang.Boolean> setCookie (java.lang.String name, java.lang.String value, java.lang.String url, java.lang.String domain, java.lang.String path, java.lang.Boolean secure, java.lang.Boolean httpOnly, java.lang.String sameSite, java.lang.Number expires, java.lang.String priority, java.lang.Boolean sameParty, java.lang.String sourceScheme, java.lang.Integer sourcePort)
Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.- Parameters:
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.
OPTIONALdomain
- Cookie domain.
OPTIONALpath
- Cookie path.
OPTIONALsecure
- True if cookie is secure.
OPTIONALhttpOnly
- True if cookie is http-only.
OPTIONALsameSite
- Cookie SameSite type.
OPTIONALexpires
- Cookie expiration date, session cookie if not set
OPTIONALpriority
- Cookie Priority type.
OPTIONAL
EXPERIMENTALsameParty
- True if cookie is SameParty.
OPTIONAL
EXPERIMENTALsourceScheme
- Cookie source scheme type.
OPTIONAL
EXPERIMENTALsourcePort
- 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.
OPTIONAL
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
, Boolean>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, Boolean>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsBoolean (success
)
Always set to true. If an error occurs, the response indicates protocol error.
-
setCookies
public static Script<java.lang.String,JsonObject,Ret0> setCookies (Network.CookieParam[] cookies)
Sets given cookies.- Parameters:
cookies
- Cookies to be set.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setExtraHTTPHeaders
public static Script<java.lang.String,JsonObject,Ret0> setExtraHTTPHeaders (JsonObject headers)
Specifies whether to always send extra HTTP headers with the requests from this page.- Parameters:
headers
- Map with extra HTTP headers.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setAttachDebugStack
public static Script<java.lang.String,JsonObject,Ret0> setAttachDebugStack (boolean enabled)
Specifies whether to attach a page script stack id in requests
EXPERIMENTAL- Parameters:
enabled
- Whether to attach a page script stack for debugging purpose.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setRequestInterception
public static Script<java.lang.String,JsonObject,Ret0> setRequestInterception (Network.RequestPattern[] patterns)
Sets the requests to intercept that match the provided patterns and optionally resource types. Deprecated, please use Fetch.enable instead.
EXPERIMENTAL
DEPRECATED- Parameters:
patterns
- Requests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setUserAgentOverride
public static Script<java.lang.String,JsonObject,Ret0> setUserAgentOverride (java.lang.String userAgent, java.lang.String acceptLanguage, java.lang.String platform, Emulation.UserAgentMetadata userAgentMetadata)
Allows overriding user agent with the given string.- Parameters:
userAgent
- User agent to use.acceptLanguage
- Browser langugage to emulate.
OPTIONALplatform
- The platform navigator.platform should return.
OPTIONALuserAgentMetadata
- To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
OPTIONAL
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
getSecurityIsolationStatus
public static Script<java.lang.String,JsonObject,Network.SecurityIsolationStatus> getSecurityIsolationStatus (java.lang.String frameId)
Returns information about the COEP/COOP isolation status.
EXPERIMENTAL- Parameters:
frameId
- If no frameId is provided, the status of the target is provided.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Network.SecurityIsolationStatus
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Network.SecurityIsolationStatus
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Network.SecurityIsolationStatus
(status
-
-
enableReportingApi
public static Script<java.lang.String,JsonObject,Ret0> enableReportingApi (boolean enable)
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.
EXPERIMENTAL- Parameters:
enable
- Whether to enable or disable events for the Reporting API- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
loadNetworkResource
public static Script<java.lang.String,JsonObject,Network.LoadNetworkResourcePageResult> loadNetworkResource (java.lang.String frameId, java.lang.String url, Network.LoadNetworkResourceOptions options)
Fetches the resource and returns the content.
EXPERIMENTAL- Parameters:
frameId
- Frame id to get the resource for. Mandatory for frame targets, and should be omitted for worker targets.
OPTIONALurl
- URL of the resource to get content for.options
- Options for the request.- Returns:
- An instance of
Script
<String,JsonObject
,Network.LoadNetworkResourcePageResult
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Network.LoadNetworkResourcePageResult
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Network.LoadNetworkResourcePageResult
(resource
-
-
-