Class Network


  • public class Network
    extends java.lang.Object

    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.

    These files were converted into this Java-Browser (CDP) Library. The intention is to have them function in a similar fasion to the Node.js Tool known as 'Puppeteer', Microsoft's 'Playwright' and of course the Main-Stay 'Selenium.' The Java-HTML JAR Library merely implements the Java Types & Commands defined by Google's DevTools Protocol.

    🧠 View the Google CDP API:

    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.

    The top-level description and explanation for this class (this comment, at the top this Java-Doc Page) is repeated, verbatim, across all of the domain classes which comprise Google's CDP API.

    This class is intended to be used with a Browser Instance

    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 a Remote Debugging Port. Google-Corporation is the developer of this API, but any browser which accepts a Remote Debug Port Connection over Web-Sockets.

    Google-Chrome was used during the development process of the classes in this particular package. Lately, it has been asserted Microsoft has switched to using the Chrome Browser-Engine for its Microsoft Edge Internal Code-Base. Therefore, there may some functionality available when running the methods in this class with Microsoft-Edge.

    Check whether the your Web-Browser will allow itself to be driven by the Web-Socket RDP-Port 9223. See the examples available in package Torello.Browser to undertand how to build a PageConn and BrowserConn Web-Socket Connection, and how to build a WebSocketSender instance in order to execute the methods in this class.


    Web-Socket & JSON API:   
    Every one of the methods that reside in this class are designed to do nothing more than:

    1. Accept Parameters from the User, and "Marshall Them" into a Valid JSON-Request
    2. Transmit the Marshalled Request-JSON to a Headless Web-Browser over a Web-Socket Connection
    3. Receive BOTH that Command-Results AND any Browser Event-Firings from the Web-Socket
    4. Parse JSON Method-Results and Browser-Event Firings, and Subsequently Convert them to Standard Java-Types
    5. Report these Method-Results and Browser-Events to the User via a User-Registered, Event-Listener (Events) or a Promise Object (Command Responses / Results)

    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".


    Asking Chat-GPT for Help:   
    The LLM otherwise known as "Chat-GPT" does, indeed, have an expert level of knowledge about the "Remote DevTools Protocol". The API that the Chrome DevTools Protocl (CDP) exports is extremely well understood by the LLM, and generally I have found that Chat-GPT understands (by 2 or 3 orders of magnitude) better what my Auto-Generated JSON-Wrappers can do in controlling a Web-Browser than I could ever possibly hope to understand.

    Though not available today, there will soon be an automatically downloadable Token-Stream (AI Embeddings) BUTTON available on my Java-Doc Pages that should hopefully make it extremely easy to post my code-base, RAG Style, to Chat-GPT and other LLM's when 'interogating' them. Presently, because my "Get Token Stream Button" does not exist yet on any of my pages, what you can do is copy-and-paste any Method-Signature from any one of these pages and then ask Chat-GPT to explain what that Browser or Java-Script Function is actually doing. It is very likely to give you some pretty neat answers.

    I have found that every single one of the Domains, Types & Events which are offered by the CDP Protocol (though not documented very well by Google), are perfectly understood by the A.I. LLM - literally to the point where it does know (much better than I ever could) what my own code base actually does!

    Try it out, it's a lot of fun. Note that this package and these classes were originally developed solely to be able to execute the Java-Script that a browser executes when visiting a Web-Site. Complete HTML-Page Content can be scraped (using the HTML Data-Scraping Tools in Java-HTML) off of Web-Sites that have dynamic / Java-Script Generated Content.


    Conspicuous Boxed-Types Usage:
    You may notice that there are many methods that have parameters which accept, for instance, an Integer, instead of a primitive int. Just to remind the readiner, in Java Programs a Boxed Type is a standard Java-Primitive which has been converted into an Object-Reference. The use of Boxed-Types in this code base is an easy-and-fast-way to allow for the concept of "Optional Parameters" or "Optional Field Value."

    Whenever you see a method that accepts an Integer, the reason for this Parameter-Type choice is actually to allow a user to pass 'null' to it. This is a simple way to ELIDE passing any value at all to parameters which Google-Chrome would otherwise assert are "Optional." Whenever you pass 'null' to a Boxed-Types in this class, the Json-Processor will simply eliminate that Object-Property from the command altogether; and the browser will simply not receive any value for that parameter when that command is invoked.

    The Java Language Specification does not have an easy or well defined means of accepting optional method parameters; so Boxed-Types and 'null' are utilized here. Note that 'null' may be passed to any Command Method-Parameter that is listed as Optional on the Java-Doc Page description for that parameter.



    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
    • 39 Method(s), 39 declared static
    • 35 Field(s), 35 declared static, 35 declared final


    • Field Detail

      • Headers

        🡇     🗕  🗗  🗖
        public static final java.lang.String Headers
        Request / response headers as keys / values of JSON object.

        The Type Headers has been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simple String Constant, for documentation & reference purposes only.

        The code which is generated which employs this type replaces its use with the Standard Java-Type: JsonValue

        Eliminated Type
        See Also:
        Constant Field Values
      • InterceptionId

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String InterceptionId
        Unique intercepted request identifier.

        The Type InterceptionId has been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simple String Constant, for documentation & reference purposes only.

        The code which is generated which employs this type replaces its use with the Standard Java-Type: String

        Eliminated Type
        See Also:
        Constant Field Values
      • LoaderId

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String LoaderId
        Unique loader identifier.

        The Type LoaderId has been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simple String Constant, for documentation & reference purposes only.

        The code which is generated which employs this type replaces its use with the Standard Java-Type: String

        Eliminated Type
        See Also:
        Constant Field Values
      • MonotonicTime

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String MonotonicTime
        Monotonically increasing time in seconds since an arbitrary point in the past.

        The Type MonotonicTime has been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simple String Constant, for documentation & reference purposes only.

        The code which is generated which employs this type replaces its use with the Standard Java-Type: Number

        Eliminated Type
        See Also:
        Constant Field Values
      • ReportId

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String ReportId
        [No Description Provided by Google]
        EXPERIMENTAL

        The Type ReportId has been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simple String Constant, for documentation & reference purposes only.

        The code which is generated which employs this type replaces its use with the Standard Java-Type: String

        Eliminated Type
        See Also:
        Constant Field Values
      • RequestId

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String RequestId
        Unique network request identifier. Note that this does not identify individual HTTP requests that are part of a network request.

        The Type RequestId has been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simple String Constant, for documentation & reference purposes only.

        The code which is generated which employs this type replaces its use with the Standard Java-Type: String

        Eliminated Type
        See Also:
        Constant Field Values
      • TimeSinceEpoch

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String TimeSinceEpoch
        UTC time in seconds, counted from January 1, 1970.

        The Type TimeSinceEpoch has been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simple String Constant, for documentation & reference purposes only.

        The code which is generated which employs this type replaces its use with the Standard Java-Type: Number

        Eliminated Type
        See Also:
        Constant Field Values
      • policyUpdated

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String policyUpdated
        Fired once security policy has been updated.
        EXPERIMENTAL

        This is Marker-Event. Marker-Event's are events that do not possess any data or fields at all. When such events are fired by the browser, the Web-Socket sends nothing more than the name of the event in the packet. The Java-HTML CDP Implementation (this library) has not actually created a dedicated Java Event-Type for this Browser Event.

        This specific static field is actually just declared a String.
        policyUpdated has not been 'reified' into an actual nested / inner class of its own, at all.

        Eliminated Event Type
        See Also:
        Constant Field Values
      • CookiePriority

        🡅  🡇     🗕  🗗  🗖
        public static final ReadOnlyList<java.lang.String> CookiePriority
        Represents the cookie's 'Priority' status: https://tools.ietf.org/html/draft-west-cookie-priority-00
        EXPERIMENTAL

        String-Enumeration Type
      • CookieSourceScheme

        🡅  🡇     🗕  🗗  🗖
        public static final ReadOnlyList<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

        String-Enumeration Type
      • InterceptionStage

        🡅  🡇     🗕  🗗  🗖
        public static final ReadOnlyList<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

        String-Enumeration Type
    • Method Detail

      • canClearBrowserCache

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Boolean> canClearBrowserCache()
        Tells whether clearing browser cache is supported.
        DEPRECATED
        Returns:
        An instance of Script<Boolean>

        This script may be executed, using Script.exec, and afterwards, a Promise <Boolean> will be returned

        Finally, the Promise may be awaited, using Promise.await(), and the returned result of this Browser Function may be retrieved.

        This Browser Function's Promise returns: Boolean (result)
        True if browser cache can be cleared.
      • canClearBrowserCookies

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Boolean> canClearBrowserCookies()
        Tells whether clearing browser cookies is supported.
        DEPRECATED
        Returns:
        An instance of Script<Boolean>

        This script may be executed, using Script.exec, and afterwards, a Promise <Boolean> will be returned

        Finally, the Promise may be awaited, using Promise.await(), and the returned result of this Browser Function may be retrieved.

        This Browser Function's Promise returns: Boolean (result)
        True if browser cookies can be cleared.
      • canEmulateNetworkConditions

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Boolean> canEmulateNetworkConditions()
        Tells whether emulation of network conditions is supported.
        DEPRECATED
        Returns:
        An instance of Script<Boolean>

        This script may be executed, using Script.exec, and afterwards, a Promise <Boolean> will be returned

        Finally, the Promise may be awaited, using Promise.await(), and the returned result of this Browser Function may be retrieved.

        This Browser Function's Promise returns: Boolean (result)
        True if emulation of network conditions is supported.
      • clearAcceptedEncodingsOverride

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> clearAcceptedEncodingsOverride()
        Clears accepted encodings set by setAcceptedEncodings
        EXPERIMENTAL
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • clearBrowserCache

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> clearBrowserCache()
        Clears browser cache.
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • clearBrowserCookies

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> clearBrowserCookies()
        Clears browser cookies.
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • continueInterceptedRequest

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> 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,
                     JsonValue 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.
        EXPERIMENTALDEPRECATED

        👍 Because of the sheer number of input parameters to this method, there is a a CommandBuilder variant to this method which may be invoked instead.

        Please View: continueInterceptedRequest()
        Parameters:
        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.
        OPTIONAL
        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)
        OPTIONAL
        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.
        OPTIONAL
        method - If set this allows the request method to be overridden. Must not be set in response to an authChallenge.
        OPTIONAL
        postData - If set this allows postData to be set. Must not be set in response to an authChallenge.
        OPTIONAL
        headers - If set this allows the request headers to be changed. Must not be set in response to an authChallenge.
        OPTIONAL
        authChallengeResponse - Response to a requestIntercepted with an authChallenge. Must not be set otherwise.
        OPTIONAL
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • deleteCookies

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> deleteCookies​
                    (java.lang.String name,
                     java.lang.String url,
                     java.lang.String domain,
                     java.lang.String path,
                     Network.CookiePartitionKey partitionKey)
        
        Deletes browser cookies with matching name and url or domain/path/partitionKey pair.

        👍 Because of the sheer number of input parameters to this method, there is a a CommandBuilder variant to this method which may be invoked instead.

        Please View: deleteCookies()
        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.
        OPTIONAL
        domain - If specified, deletes only cookies with the exact domain.
        OPTIONAL
        path - If specified, deletes only cookies with the exact path.
        OPTIONAL
        partitionKey - If specified, deletes only cookies with the the given name and partitionKey where all partition key attributes match the cookie partition key attribute.
        OPTIONALEXPERIMENTAL
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • disable

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> disable()
        Disables network tracking, prevents network events from being sent to the client.
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • emulateNetworkConditions

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> emulateNetworkConditions​
                    (boolean offline,
                     java.lang.Number latency,
                     java.lang.Number downloadThroughput,
                     java.lang.Number uploadThroughput,
                     java.lang.String connectionType,
                     java.lang.Number packetLoss,
                     java.lang.Integer packetQueueLength,
                     java.lang.Boolean packetReordering)
        
        Activates emulation of network conditions.

        👍 Because of the sheer number of input parameters to this method, there is a a CommandBuilder variant to this method which may be invoked instead.

        Please View: emulateNetworkConditions()
        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
        packetLoss - WebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets.
        OPTIONALEXPERIMENTAL
        packetQueueLength - WebRTC packet queue length (packet). 0 removes any queue length limitations.
        OPTIONALEXPERIMENTAL
        packetReordering - WebRTC packetReordering feature.
        OPTIONALEXPERIMENTAL
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • enable

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> enable​
                    (java.lang.Integer maxTotalBufferSize,
                     java.lang.Integer maxResourceBufferSize,
                     java.lang.Integer maxPostDataSize,
                     java.lang.Boolean reportDirectSocketTraffic)
        
        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).
        OPTIONALEXPERIMENTAL
        maxResourceBufferSize - Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
        OPTIONALEXPERIMENTAL
        maxPostDataSize - Longest post body size (in bytes) that would be included in requestWillBeSent notification
        OPTIONAL
        reportDirectSocketTraffic - Whether DirectSocket chunk send/receive events should be reported.
        OPTIONALEXPERIMENTAL
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • enableReportingApi

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> 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<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • getCertificate

        🡅  🡇     🗕  🗗  🗖
        public static Script<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[]>

        This script may be executed, using Script.exec, and afterwards, a Promise <String[]> will be returned

        Finally, the Promise may be awaited, using Promise.await(), and the returned result of this Browser Function may be retrieved.

        This Browser Function's Promise returns: String[] (tableNames)
      • getCookies

        🡅  🡇     🗕  🗗  🗖
        public static Script<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 the cookies 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<Network.Cookie[]>

        This script may be executed, using Script.exec, and afterwards, a Promise <Network.Cookie[]> will be returned

        Finally, the Promise may be awaited, using Promise.await(), and the returned result of this Browser Function may be retrieved.

        This Browser Function's Promise returns: Network.Cookie[] (cookies)
        Array of cookie objects.
      • getRequestPostData

        🡅  🡇     🗕  🗗  🗖
        public static Script<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>

        This script may be executed, using Script.exec, and afterwards, a Promise <String> will be returned

        Finally, the Promise may be awaited, using Promise.await(), and the returned result of this Browser Function may be retrieved.

        This Browser Function's Promise returns: String (postData)
        Request body string, omitting files from multipart requests
      • replayXHR

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> 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<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • searchInResponseBody

        🡅  🡇     🗕  🗗  🗖
        public static Script<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.
        OPTIONAL
        isRegex - If true, treats string parameter as regex.
        OPTIONAL
        Returns:
        An instance of Script<Debugger.SearchMatch[]>

        This script may be executed, using Script.exec, and afterwards, a Promise <Debugger.SearchMatch[]> will be returned

        Finally, the Promise may be awaited, using Promise.await(), and the returned result of this Browser Function may be retrieved.

        This Browser Function's Promise returns: Debugger.SearchMatch[] (result)
        List of search matches.
      • setAcceptedEncodings

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> 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<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • setAttachDebugStack

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> 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<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • setBlockedURLs

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setBlockedURLs​
                    (java.lang.String[] urls)
        
        Blocks URLs from loading.
        EXPERIMENTAL
        Parameters:
        urls - URL patterns to block. Wildcards ('*') are allowed.
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • setBypassServiceWorker

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setBypassServiceWorker​
                    (boolean bypass)
        
        Toggles ignoring of service worker for each request.
        Parameters:
        bypass - Bypass service worker and load from network.
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • setCacheDisabled

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setCacheDisabled​
                    (boolean cacheDisabled)
        
        Toggles ignoring cache for each request. If true, cache will not be used.
        Parameters:
        cacheDisabled - Cache disabled state.
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • setCookie

        🡅  🡇     🗕  🗗  🗖
        public static Script<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,
                     Network.CookiePartitionKey partitionKey)
        
        Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.

        👍 Because of the sheer number of input parameters to this method, there is a a CommandBuilder variant to this method which may be invoked instead.

        Please View: setCookie()
        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.
        OPTIONAL
        domain - Cookie domain.
        OPTIONAL
        path - Cookie path.
        OPTIONAL
        secure - True if cookie is secure.
        OPTIONAL
        httpOnly - True if cookie is http-only.
        OPTIONAL
        sameSite - Cookie SameSite type.
        OPTIONAL
        expires - Cookie expiration date, session cookie if not set
        OPTIONAL
        priority - Cookie Priority type.
        OPTIONALEXPERIMENTAL
        sameParty - True if cookie is SameParty.
        OPTIONALEXPERIMENTAL
        sourceScheme - Cookie source scheme type.
        OPTIONALEXPERIMENTAL
        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.
        OPTIONALEXPERIMENTAL
        partitionKey - Cookie partition key. If not set, the cookie will be set as not partitioned.
        OPTIONALEXPERIMENTAL
        Returns:
        An instance of Script<Boolean>

        This script may be executed, using Script.exec, and afterwards, a Promise <Boolean> will be returned

        Finally, the Promise may be awaited, using Promise.await(), and the returned result of this Browser Function may be retrieved.

        This Browser Function's Promise returns: Boolean (success)
        Always set to true. If an error occurs, the response indicates protocol error.
      • setCookieControls

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setCookieControls​
                    (boolean enableThirdPartyCookieRestriction,
                     boolean disableThirdPartyCookieMetadata,
                     boolean disableThirdPartyCookieHeuristics)
        
        Sets Controls for third-party cookie access Page reload is required before the new cookie behavior will be observed
        EXPERIMENTAL
        Parameters:
        enableThirdPartyCookieRestriction - Whether 3pc restriction is enabled.
        disableThirdPartyCookieMetadata - Whether 3pc grace period exception should be enabled; false by default.
        disableThirdPartyCookieHeuristics - Whether 3pc heuristics exceptions should be enabled; false by default.
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • setCookies

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setCookies​
                    (Network.CookieParam[] cookies)
        
        Sets given cookies.
        Parameters:
        cookies - Cookies to be set.
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • setExtraHTTPHeaders

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setExtraHTTPHeaders​
                    (JsonValue 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<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • setRequestInterception

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setRequestInterception​
                    (Network.RequestPattern[] patterns)
        
        Sets the requests to intercept that match the provided patterns and optionally resource types. Deprecated, please use Fetch.enable instead.
        EXPERIMENTALDEPRECATED
        Parameters:
        patterns - Requests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call.
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • setUserAgentOverride

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> 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 language to emulate.
        OPTIONAL
        platform - The platform navigator.platform should return.
        OPTIONAL
        userAgentMetadata - To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
        OPTIONALEXPERIMENTAL
        Returns:
        An instance of Script<Void>

        This Script 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 the Promise<Void> to ensure that the Browser Function has run to completion.
      • streamResourceContent

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String> streamResourceContent​
                    (java.lang.String requestId)
        
        Enables streaming of the response for the given requestId. If enabled, the dataReceived event contains the data that was received during streaming.
        EXPERIMENTAL
        Parameters:
        requestId - Identifier of the request to stream.
        Returns:
        An instance of Script<String>

        This script may be executed, using Script.exec, and afterwards, a Promise <String> will be returned

        Finally, the Promise may be awaited, using Promise.await(), and the returned result of this Browser Function may be retrieved.

        This Browser Function's Promise returns: String (bufferedData)
        Data that has been buffered until streaming is enabled. (Encoded as a base64 string when passed over JSON)
      • takeResponseBodyForInterceptionAsStream

        🡅  🡇     🗕  🗗  🗖
        public static Script<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>

        This script may be executed, using Script.exec, and afterwards, a Promise <String> will be returned

        Finally, the Promise may be awaited, using Promise.await(), and the returned result of this Browser Function may be retrieved.

        This Browser Function's Promise returns: String (stream)