Class Page


  • public class Page
    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:

    Actions and events related to the inspected page belong to the page domain.

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


    • Field Detail

      • FrameId

        🡇     🗕  🗗  🗖
        public static final java.lang.String FrameId
        Unique frame identifier.

        The Type FrameId 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
      • ScriptIdentifier

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String ScriptIdentifier
        Unique script identifier.

        The Type ScriptIdentifier 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
      • frameResized

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String frameResized
        [No Description Provided by Google]
        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.
        frameResized has not been 'reified' into an actual nested / inner class of its own, at all.

        Eliminated Event Type
        See Also:
        Constant Field Values
      • interstitialHidden

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String interstitialHidden
        Fired when interstitial page was hidden

        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.
        interstitialHidden has not been 'reified' into an actual nested / inner class of its own, at all.

        Eliminated Event Type
        See Also:
        Constant Field Values
      • interstitialShown

        🡅  🡇     🗕  🗗  🗖
        public static final java.lang.String interstitialShown
        Fired when interstitial page was shown

        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.
        interstitialShown has not been 'reified' into an actual nested / inner class of its own, at all.

        Eliminated Event Type
        See Also:
        Constant Field Values
      • PermissionsPolicyFeature

        🡅  🡇     🗕  🗗  🗖
        public static final ReadOnlyList<java.lang.String> PermissionsPolicyFeature
        All Permissions Policy features. This enum should match the one defined in services/network/public/cpp/permissions_policy/permissions_policy_features.json5. LINT.IfChange(PermissionsPolicyFeature)
        EXPERIMENTAL

        String-Enumeration Type
    • Method Detail

      • addCompilationCache

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> addCompilationCache​
                    (java.lang.String url,
                     java.lang.String data)
        
        Seeds compilation cache for given url. Compilation cache does not survive cross-process navigation.
        EXPERIMENTAL
        Parameters:
        url - -
        data - Base64-encoded data (Encoded as a base64 string when passed over JSON)
        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.
      • addScriptToEvaluateOnLoad

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String> addScriptToEvaluateOnLoad​
                    (java.lang.String scriptSource)
        
        Deprecated, please use addScriptToEvaluateOnNewDocument instead.
        EXPERIMENTALDEPRECATED
        Parameters:
        scriptSource - -
        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 (identifier)
        Identifier of the added script.
      • addScriptToEvaluateOnNewDocument

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String> addScriptToEvaluateOnNewDocument​
                    (java.lang.String source,
                     java.lang.String worldName,
                     java.lang.Boolean includeCommandLineAPI,
                     java.lang.Boolean runImmediately)
        
        Evaluates given script in every frame upon creation (before loading frame's scripts).
        Parameters:
        source - -
        worldName - If specified, creates an isolated world with the given name and evaluates given script in it. This world name will be used as the ExecutionContextDescription::name when the corresponding event is emitted.
        OPTIONALEXPERIMENTAL
        includeCommandLineAPI - Specifies whether command line API should be available to the script, defaults to false.
        OPTIONALEXPERIMENTAL
        runImmediately - If true, runs the script immediately on existing execution contexts or worlds. Default: false.
        OPTIONALEXPERIMENTAL
        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 (identifier)
        Identifier of the added script.
      • bringToFront

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> bringToFront()
        Brings page to front (activates tab).
        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.
      • captureScreenshot

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String> captureScreenshot​
                    (java.lang.String format,
                     java.lang.Integer quality,
                     Page.Viewport clip,
                     java.lang.Boolean fromSurface,
                     java.lang.Boolean captureBeyondViewport,
                     java.lang.Boolean optimizeForSpeed)
        
        Capture page screenshot.

        👍 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: captureScreenshot()
        Parameters:
        format - Image compression format (defaults to png).
        Acceptable Values: ["jpeg", "png", "webp"]
        OPTIONAL
        quality - Compression quality from range [0..100] (jpeg only).
        OPTIONAL
        clip - Capture the screenshot of a given region only.
        OPTIONAL
        fromSurface - Capture the screenshot from the surface, rather than the view. Defaults to true.
        OPTIONALEXPERIMENTAL
        captureBeyondViewport - Capture the screenshot beyond the viewport. Defaults to false.
        OPTIONALEXPERIMENTAL
        optimizeForSpeed - Optimize image encoding for speed, not for resulting size (defaults to false)
        OPTIONALEXPERIMENTAL
        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 (data)
        Base64-encoded image data. (Encoded as a base64 string when passed over JSON)
      • captureSnapshot

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String> captureSnapshot​
                    (java.lang.String format)
        
        Returns a snapshot of the page as a string. For MHTML format, the serialization includes iframes, shadow DOM, external resources, and element-inline styles.
        EXPERIMENTAL
        Parameters:
        format - Format (defaults to mhtml).
        Acceptable Values: ["mhtml"]
        OPTIONAL
        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 (data)
        Serialized page data.
      • clearCompilationCache

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> clearCompilationCache()
        Clears seeded compilation cache.
        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.
      • clearDeviceMetricsOverride

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> clearDeviceMetricsOverride()
        Clears the overridden device metrics.
        EXPERIMENTALDEPRECATED
        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.
      • clearDeviceOrientationOverride

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> clearDeviceOrientationOverride()
        Clears the overridden Device Orientation.
        EXPERIMENTALDEPRECATED
        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.
      • clearGeolocationOverride

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> clearGeolocationOverride()
        Clears the overridden Geolocation Position and Error.
        DEPRECATED
        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.
      • close

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> close()
        Tries to close page, running its beforeunload hooks, if any.
        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.
      • crash

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> crash()
        Crashes renderer on the IO thread, generates minidumps.
        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.
      • createIsolatedWorld

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Integer> createIsolatedWorld​
                    (java.lang.String frameId,
                     java.lang.String worldName,
                     java.lang.Boolean grantUniveralAccess)
        
        Creates an isolated world for the given frame.
        Parameters:
        frameId - Id of the frame in which the isolated world should be created.
        worldName - An optional name which is reported in the Execution Context.
        OPTIONAL
        grantUniveralAccess - Whether or not universal access should be granted to the isolated world. This is a powerful option, use with caution.
        OPTIONAL
        Returns:
        An instance of Script<Integer>

        This script may be executed, using Script.exec, and afterwards, a Promise <Integer> 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: Integer (executionContextId)
        Execution context of the isolated world.
      • deleteCookie

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> deleteCookie​
                    (java.lang.String cookieName,
                     java.lang.String url)
        
        Deletes browser cookie with given name, domain and path.
        EXPERIMENTALDEPRECATED
        Parameters:
        cookieName - Name of the cookie to remove.
        url - URL to match cooke domain and path.
        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 page domain notifications.
        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.Boolean enableFileChooserOpenedEvent)
        
        Enables page domain notifications.
        Parameters:
        enableFileChooserOpenedEvent - If true, the Page.fileChooserOpened event will be emitted regardless of the state set by Page.setInterceptFileChooserDialog command (default: false).
        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.
      • generateTestReport

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> generateTestReport​
                    (java.lang.String message,
                     java.lang.String group)
        
        Generates a report for testing.
        EXPERIMENTAL
        Parameters:
        message - Message to be displayed in the report.
        group - Specifies the endpoint group to deliver the report to.
        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.
      • getAdScriptAncestry

        🡅  🡇     🗕  🗗  🗖
        public static Script<Page.AdScriptAncestrygetAdScriptAncestry​
                    (java.lang.String frameId)
        
        [No Description Provided by Google]
        EXPERIMENTAL
        Parameters:
        frameId - -
        Returns:
        An instance of Script<Page.AdScriptAncestry>

        This script may be executed, using Script.exec, and afterwards, a Promise <Page.AdScriptAncestry> 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: Page.AdScriptAncestry (adScriptAncestry)
        The ancestry chain of ad script identifiers leading to this frame's creation, along with the root script's filterlist rule. The ancestry chain is ordered from the most immediate script (in the frame creation stack) to more distant ancestors (that created the immediately preceding script). Only sent if frame is labelled as an ad and ids are available.
      • getAppManifest

        🡅  🡇     🗕  🗗  🗖
        public static Script<Page.getAppManifest$$RETgetAppManifest​
                    (java.lang.String manifestId)
        
        Gets the processed manifest for this current document. This API always waits for the manifest to be loaded. If manifestId is provided, and it does not match the manifest of the current document, this API errors out. If there is not a loaded page, this API errors out immediately.
        Parameters:
        manifestId - -
        OPTIONAL
        Returns:
        An instance of Script<Page.getAppManifest$$RET>

        This script may be executed, using Script.exec, and afterwards, a Promise <Page.getAppManifest$$RET> 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:Page.getAppManifest$$RET A dedicated return type implies that the browser may return more than 1 datum
      • getManifestIcons

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.String> getManifestIcons()
        Deprecated because it's not guaranteed that the returned icon is in fact the one used for PWA installation.
        EXPERIMENTALDEPRECATED
        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 (primaryIcon)
      • handleJavaScriptDialog

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> handleJavaScriptDialog​
                    (boolean accept,
                     java.lang.String promptText)
        
        Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
        Parameters:
        accept - Whether to accept or dismiss the dialog.
        promptText - The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog.
        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.
      • navigate

        🡅  🡇     🗕  🗗  🗖
        public static Script<Page.navigate$$RETnavigate​
                    (java.lang.String url,
                     java.lang.String referrer,
                     java.lang.String transitionType,
                     java.lang.String frameId,
                     java.lang.String referrerPolicy)
        
        Navigates current page to the given URL.

        👍 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: navigate()
        Parameters:
        url - URL to navigate the page to.
        referrer - Referrer URL.
        OPTIONAL
        transitionType - Intended transition type.
        OPTIONAL
        frameId - Frame id to navigate, if not specified navigates the top frame.
        OPTIONAL
        referrerPolicy - Referrer-policy used for the navigation.
        OPTIONALEXPERIMENTAL
        Returns:
        An instance of Script<Page.navigate$$RET>

        This script may be executed, using Script.exec, and afterwards, a Promise <Page.navigate$$RET> 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:Page.navigate$$RET A dedicated return type implies that the browser may return more than 1 datum
      • navigateToHistoryEntry

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> navigateToHistoryEntry​(int entryId)
        Navigates current page to the given history entry.
        Parameters:
        entryId - Unique id of the entry to navigate to.
        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.
      • printToPDF

        🡅  🡇     🗕  🗗  🗖
        public static Script<Page.printToPDF$$RETprintToPDF​
                    (java.lang.Boolean landscape,
                     java.lang.Boolean displayHeaderFooter,
                     java.lang.Boolean printBackground,
                     java.lang.Number scale,
                     java.lang.Number paperWidth,
                     java.lang.Number paperHeight,
                     java.lang.Number marginTop,
                     java.lang.Number marginBottom,
                     java.lang.Number marginLeft,
                     java.lang.Number marginRight,
                     java.lang.String pageRanges,
                     java.lang.String headerTemplate,
                     java.lang.String footerTemplate,
                     java.lang.Boolean preferCSSPageSize,
                     java.lang.String transferMode,
                     java.lang.Boolean generateTaggedPDF,
                     java.lang.Boolean generateDocumentOutline)
        
        Print page as PDF.

        👍 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: printToPDF()
        Parameters:
        landscape - Paper orientation. Defaults to false.
        OPTIONAL
        displayHeaderFooter - Display header and footer. Defaults to false.
        OPTIONAL
        printBackground - Print background graphics. Defaults to false.
        OPTIONAL
        scale - Scale of the webpage rendering. Defaults to 1.
        OPTIONAL
        paperWidth - Paper width in inches. Defaults to 8.5 inches.
        OPTIONAL
        paperHeight - Paper height in inches. Defaults to 11 inches.
        OPTIONAL
        marginTop - Top margin in inches. Defaults to 1cm (~0.4 inches).
        OPTIONAL
        marginBottom - Bottom margin in inches. Defaults to 1cm (~0.4 inches).
        OPTIONAL
        marginLeft - Left margin in inches. Defaults to 1cm (~0.4 inches).
        OPTIONAL
        marginRight - Right margin in inches. Defaults to 1cm (~0.4 inches).
        OPTIONAL
        pageRanges - Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are printed in the document order, not in the order specified, and no more than once. Defaults to empty string, which implies the entire document is printed. The page numbers are quietly capped to actual page count of the document, and ranges beyond the end of the document are ignored. If this results in no pages to print, an error is reported. It is an error to specify a range with start greater than end.
        OPTIONAL
        headerTemplate - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: - date: formatted print date - title: document title - url: document location - pageNumber: current page number - totalPages: total pages in the document For example, would generate span containing the title.
        OPTIONAL
        footerTemplate - HTML template for the print footer. Should use the same format as the headerTemplate.
        OPTIONAL
        preferCSSPageSize - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.
        OPTIONAL
        transferMode - return as stream
        Acceptable Values: ["ReturnAsBase64", "ReturnAsStream"]
        OPTIONALEXPERIMENTAL
        generateTaggedPDF - Whether or not to generate tagged (accessible) PDF. Defaults to embedder choice.
        OPTIONALEXPERIMENTAL
        generateDocumentOutline - Whether or not to embed the document outline into the PDF.
        OPTIONALEXPERIMENTAL
        Returns:
        An instance of Script<Page.printToPDF$$RET>

        This script may be executed, using Script.exec, and afterwards, a Promise <Page.printToPDF$$RET> 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:Page.printToPDF$$RET A dedicated return type implies that the browser may return more than 1 datum
      • produceCompilationCache

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> produceCompilationCache​
                    (Page.CompilationCacheParams[] scripts)
        
        Requests backend to produce compilation cache for the specified scripts. scripts are appended to the list of scripts for which the cache would be produced. The list may be reset during page navigation. When script with a matching URL is encountered, the cache is optionally produced upon backend discretion, based on internal heuristics. See also: Page.compilationCacheProduced.
        EXPERIMENTAL
        Parameters:
        scripts - -
        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.
      • reload

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> reload​
                    (java.lang.Boolean ignoreCache,
                     java.lang.String scriptToEvaluateOnLoad,
                     java.lang.String loaderId)
        
        Reloads given page optionally ignoring the cache.
        Parameters:
        ignoreCache - If true, browser cache is ignored (as if the user pressed Shift+refresh).
        OPTIONAL
        scriptToEvaluateOnLoad - If set, the script will be injected into all frames of the inspected page after reload. Argument will be ignored if reloading dataURL origin.
        OPTIONAL
        loaderId - If set, an error will be thrown if the target page's main frame's loader id does not match the provided id. This prevents accidentally reloading an unintended target in case there's a racing navigation.
        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.
      • removeScriptToEvaluateOnLoad

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> removeScriptToEvaluateOnLoad​
                    (java.lang.String identifier)
        
        Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
        EXPERIMENTALDEPRECATED
        Parameters:
        identifier - -
        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.
      • removeScriptToEvaluateOnNewDocument

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> removeScriptToEvaluateOnNewDocument​
                    (java.lang.String identifier)
        
        Removes given script from the list.
        Parameters:
        identifier - -
        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.
      • resetNavigationHistory

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> resetNavigationHistory()
        Resets navigation history for the current page.
        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.
      • screencastFrameAck

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> screencastFrameAck​(int sessionId)
        Acknowledges that a screencast frame has been received by the frontend.
        EXPERIMENTAL
        Parameters:
        sessionId - Frame number.
        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.
      • searchInResource

        🡅  🡇     🗕  🗗  🗖
        public static Script<Debugger.SearchMatch[]> searchInResource​
                    (java.lang.String frameId,
                     java.lang.String url,
                     java.lang.String query,
                     java.lang.Boolean caseSensitive,
                     java.lang.Boolean isRegex)
        
        Searches for given string in resource content.
        EXPERIMENTAL

        👍 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: searchInResource()
        Parameters:
        frameId - Frame id for resource to search in.
        url - URL of the resource to search in.
        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.
      • setAdBlockingEnabled

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setAdBlockingEnabled​(boolean enabled)
        Enable Chrome's experimental ad filter on all sites.
        EXPERIMENTAL
        Parameters:
        enabled - Whether to block ads.
        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.
      • setBypassCSP

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setBypassCSP​(boolean enabled)
        Enable page Content Security Policy by-passing.
        Parameters:
        enabled - Whether to bypass page CSP.
        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.
      • setDeviceMetricsOverride

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setDeviceMetricsOverride​
                    (int width,
                     int height,
                     java.lang.Number deviceScaleFactor,
                     boolean mobile,
                     java.lang.Number scale,
                     java.lang.Integer screenWidth,
                     java.lang.Integer screenHeight,
                     java.lang.Integer positionX,
                     java.lang.Integer positionY,
                     java.lang.Boolean dontSetVisibleSize,
                     Emulation.ScreenOrientation screenOrientation,
                     Page.Viewport viewport)
        
        Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results).
        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: setDeviceMetricsOverride()
        Parameters:
        width - Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
        height - Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
        deviceScaleFactor - Overriding device scale factor value. 0 disables the override.
        mobile - Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
        scale - Scale to apply to resulting view image.
        OPTIONAL
        screenWidth - Overriding screen width value in pixels (minimum 0, maximum 10000000).
        OPTIONAL
        screenHeight - Overriding screen height value in pixels (minimum 0, maximum 10000000).
        OPTIONAL
        positionX - Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
        OPTIONAL
        positionY - Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
        OPTIONAL
        dontSetVisibleSize - Do not set visible view size, rely upon explicit setVisibleSize call.
        OPTIONAL
        screenOrientation - Screen orientation override.
        OPTIONAL
        viewport - The viewport dimensions and scale. If not set, the override is cleared.
        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.
      • setDeviceOrientationOverride

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setDeviceOrientationOverride​
                    (java.lang.Number alpha,
                     java.lang.Number beta,
                     java.lang.Number gamma)
        
        Overrides the Device Orientation.
        EXPERIMENTALDEPRECATED
        Parameters:
        alpha - Mock alpha
        beta - Mock beta
        gamma - Mock gamma
        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.
      • setDocumentContent

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setDocumentContent​
                    (java.lang.String frameId,
                     java.lang.String html)
        
        Sets given markup as the document's HTML.
        Parameters:
        frameId - Frame id to set HTML for.
        html - HTML content to 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.
      • setDownloadBehavior

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setDownloadBehavior​
                    (java.lang.String behavior,
                     java.lang.String downloadPath)
        
        Set the behavior when downloading a file.
        EXPERIMENTALDEPRECATED
        Parameters:
        behavior - Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny).
        Acceptable Values: ["allow", "default", "deny"]
        downloadPath - The default path to save downloaded files to. This is required if behavior is set to 'allow'
        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.
      • setFontFamilies

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setFontFamilies​
                    (Page.FontFamilies fontFamilies,
                     Page.ScriptFontFamilies[] forScripts)
        
        Set generic font families.
        EXPERIMENTAL
        Parameters:
        fontFamilies - Specifies font families to set. If a font family is not specified, it won't be changed.
        forScripts - Specifies font families to set for individual scripts.
        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.
      • setFontSizes

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setFontSizes​
                    (Page.FontSizes fontSizes)
        
        Set default font sizes.
        EXPERIMENTAL
        Parameters:
        fontSizes - Specifies font sizes to set. If a font size is not specified, it won't be changed.
        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.
      • setGeolocationOverride

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setGeolocationOverride​
                    (java.lang.Number latitude,
                     java.lang.Number longitude,
                     java.lang.Number accuracy)
        
        Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
        DEPRECATED
        Parameters:
        latitude - Mock latitude
        OPTIONAL
        longitude - Mock longitude
        OPTIONAL
        accuracy - Mock accuracy
        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.
      • setInterceptFileChooserDialog

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setInterceptFileChooserDialog​
                    (boolean enabled,
                     java.lang.Boolean cancel)
        
        Intercept file chooser requests and transfer control to protocol clients. When file chooser interception is enabled, native file chooser dialog is not shown. Instead, a protocol event Page.fileChooserOpened is emitted.
        Parameters:
        enabled - -
        cancel - If true, cancels the dialog by emitting relevant events (if any) in addition to not showing it if the interception is enabled (default: false).
        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.
      • setLifecycleEventsEnabled

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setLifecycleEventsEnabled​
                    (boolean enabled)
        
        Controls whether page will emit lifecycle events.
        Parameters:
        enabled - If true, starts emitting lifecycle events.
        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.
      • setPrerenderingAllowed

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setPrerenderingAllowed​
                    (boolean isAllowed)
        
        Enable/disable prerendering manually. This command is a short-term solution for https://crbug.com/1440085. See https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA for more details. TODO(https://crbug.com/1440085): Remove this once Puppeteer supports tab targets.
        EXPERIMENTAL
        Parameters:
        isAllowed - -
        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.
      • setRPHRegistrationMode

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setRPHRegistrationMode​
                    (java.lang.String mode)
        
        Extensions for Custom Handlers API: https://html.spec.whatwg.org/multipage/system-state.html#rph-automation
        EXPERIMENTAL
        Parameters:
        mode - -
        Acceptable Values: ["autoAccept", "autoReject", "none"]
        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.
      • setSPCTransactionMode

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setSPCTransactionMode​
                    (java.lang.String mode)
        
        Sets the Secure Payment Confirmation transaction mode. https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode
        EXPERIMENTAL
        Parameters:
        mode - -
        Acceptable Values: ["autoAccept", "autoChooseToAuthAnotherWay", "autoOptOut", "autoReject", "none"]
        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.
      • setTouchEmulationEnabled

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setTouchEmulationEnabled​
                    (boolean enabled,
                     java.lang.String configuration)
        
        Toggles mouse event-based touch event emulation.
        EXPERIMENTALDEPRECATED
        Parameters:
        enabled - Whether the touch event emulation should be enabled.
        configuration - Touch/gesture events configuration. Default: current platform.
        Acceptable Values: ["desktop", "mobile"]
        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.
      • setWebLifecycleState

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> setWebLifecycleState​
                    (java.lang.String state)
        
        Tries to update the web lifecycle state of the page. It will transition the page to the given state according to: https://github.com/WICG/web-lifecycle/
        EXPERIMENTAL
        Parameters:
        state - Target lifecycle state
        Acceptable Values: ["active", "frozen"]
        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.
      • startScreencast

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> startScreencast​
                    (java.lang.String format,
                     java.lang.Integer quality,
                     java.lang.Integer maxWidth,
                     java.lang.Integer maxHeight,
                     java.lang.Integer everyNthFrame)
        
        Starts sending each frame using the screencastFrame event.
        EXPERIMENTAL

        👍 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: startScreencast()
        Parameters:
        format - Image compression format.
        Acceptable Values: ["jpeg", "png"]
        OPTIONAL
        quality - Compression quality from range [0..100].
        OPTIONAL
        maxWidth - Maximum screenshot width.
        OPTIONAL
        maxHeight - Maximum screenshot height.
        OPTIONAL
        everyNthFrame - Send every n-th frame.
        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.
      • stopLoading

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> stopLoading()
        Force the page stop all navigations and pending resource fetches.
        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.
      • stopScreencast

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> stopScreencast()
        Stops sending each frame in the screencastFrame.
        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.
      • waitForDebugger

        🡅  🡇     🗕  🗗  🗖
        public static Script<java.lang.Void> waitForDebugger()
        Pauses page execution. Can be resumed using generic RunTime.runIfWaitingForDebugger.
        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.