All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openqa.selenium.devtools.v120.page.Page Maven / Gradle / Ivy

Go to download

Selenium automates browsers. That's it! What you do with that power is entirely up to you.

There is a newer version: 4.18.1
Show newest version
package org.openqa.selenium.devtools.v120.page;

import org.openqa.selenium.Beta;
import org.openqa.selenium.devtools.Command;
import org.openqa.selenium.devtools.Event;
import org.openqa.selenium.devtools.ConverterFunctions;
import java.util.Map;
import java.util.LinkedHashMap;
import org.openqa.selenium.json.JsonInput;

/**
 * Actions and events related to the inspected page belong to the page domain.
 */
public class Page {

    /**
     * Deprecated, please use addScriptToEvaluateOnNewDocument instead.
     */
    @Beta()
    @Deprecated()
    public static Command addScriptToEvaluateOnLoad(java.lang.String scriptSource) {
        java.util.Objects.requireNonNull(scriptSource, "scriptSource is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("scriptSource", scriptSource);
        return new Command<>("Page.addScriptToEvaluateOnLoad", Map.copyOf(params), ConverterFunctions.map("identifier", org.openqa.selenium.devtools.v120.page.model.ScriptIdentifier.class));
    }

    /**
     * Evaluates given script in every frame upon creation (before loading frame's scripts).
     */
    public static Command addScriptToEvaluateOnNewDocument(java.lang.String source, java.util.Optional worldName, java.util.Optional includeCommandLineAPI, java.util.Optional runImmediately) {
        java.util.Objects.requireNonNull(source, "source is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("source", source);
        worldName.ifPresent(p -> params.put("worldName", p));
        includeCommandLineAPI.ifPresent(p -> params.put("includeCommandLineAPI", p));
        runImmediately.ifPresent(p -> params.put("runImmediately", p));
        return new Command<>("Page.addScriptToEvaluateOnNewDocument", Map.copyOf(params), ConverterFunctions.map("identifier", org.openqa.selenium.devtools.v120.page.model.ScriptIdentifier.class));
    }

    /**
     * Brings page to front (activates tab).
     */
    public static Command bringToFront() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.bringToFront", Map.copyOf(params));
    }

    public enum CaptureScreenshotFormat {

        JPEG("jpeg"), PNG("png"), WEBP("webp");

        private String value;

        CaptureScreenshotFormat(String value) {
            this.value = value;
        }

        public static CaptureScreenshotFormat fromString(String s) {
            return java.util.Arrays.stream(CaptureScreenshotFormat.values()).filter(rs -> rs.value.equalsIgnoreCase(s)).findFirst().orElseThrow(() -> new org.openqa.selenium.devtools.DevToolsException("Given value " + s + " is not found within CaptureScreenshotFormat "));
        }

        public String toString() {
            return value;
        }

        public String toJson() {
            return value;
        }

        private static CaptureScreenshotFormat fromJson(JsonInput input) {
            return fromString(input.nextString());
        }
    }

    /**
     * Capture page screenshot.
     */
    public static Command captureScreenshot(java.util.Optional format, java.util.Optional quality, java.util.Optional clip, java.util.Optional fromSurface, java.util.Optional captureBeyondViewport, java.util.Optional optimizeForSpeed) {
        LinkedHashMap params = new LinkedHashMap<>();
        format.ifPresent(p -> params.put("format", p));
        quality.ifPresent(p -> params.put("quality", p));
        clip.ifPresent(p -> params.put("clip", p));
        fromSurface.ifPresent(p -> params.put("fromSurface", p));
        captureBeyondViewport.ifPresent(p -> params.put("captureBeyondViewport", p));
        optimizeForSpeed.ifPresent(p -> params.put("optimizeForSpeed", p));
        return new Command<>("Page.captureScreenshot", Map.copyOf(params), ConverterFunctions.map("data", java.lang.String.class));
    }

    public enum CaptureSnapshotFormat {

        MHTML("mhtml");

        private String value;

        CaptureSnapshotFormat(String value) {
            this.value = value;
        }

        public static CaptureSnapshotFormat fromString(String s) {
            return java.util.Arrays.stream(CaptureSnapshotFormat.values()).filter(rs -> rs.value.equalsIgnoreCase(s)).findFirst().orElseThrow(() -> new org.openqa.selenium.devtools.DevToolsException("Given value " + s + " is not found within CaptureSnapshotFormat "));
        }

        public String toString() {
            return value;
        }

        public String toJson() {
            return value;
        }

        private static CaptureSnapshotFormat fromJson(JsonInput input) {
            return fromString(input.nextString());
        }
    }

    /**
     * Returns a snapshot of the page as a string. For MHTML format, the serialization includes
     * iframes, shadow DOM, external resources, and element-inline styles.
     */
    @Beta()
    public static Command captureSnapshot(java.util.Optional format) {
        LinkedHashMap params = new LinkedHashMap<>();
        format.ifPresent(p -> params.put("format", p));
        return new Command<>("Page.captureSnapshot", Map.copyOf(params), ConverterFunctions.map("data", java.lang.String.class));
    }

    /**
     * Clears the overridden device metrics.
     */
    @Beta()
    @Deprecated()
    public static Command clearDeviceMetricsOverride() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.clearDeviceMetricsOverride", Map.copyOf(params));
    }

    /**
     * Clears the overridden Device Orientation.
     */
    @Beta()
    @Deprecated()
    public static Command clearDeviceOrientationOverride() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.clearDeviceOrientationOverride", Map.copyOf(params));
    }

    /**
     * Clears the overridden Geolocation Position and Error.
     */
    @Deprecated()
    public static Command clearGeolocationOverride() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.clearGeolocationOverride", Map.copyOf(params));
    }

    /**
     * Creates an isolated world for the given frame.
     */
    public static Command createIsolatedWorld(org.openqa.selenium.devtools.v120.page.model.FrameId frameId, java.util.Optional worldName, java.util.Optional grantUniveralAccess) {
        java.util.Objects.requireNonNull(frameId, "frameId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("frameId", frameId);
        worldName.ifPresent(p -> params.put("worldName", p));
        grantUniveralAccess.ifPresent(p -> params.put("grantUniveralAccess", p));
        return new Command<>("Page.createIsolatedWorld", Map.copyOf(params), ConverterFunctions.map("executionContextId", org.openqa.selenium.devtools.v120.runtime.model.ExecutionContextId.class));
    }

    /**
     * Deletes browser cookie with given name, domain and path.
     */
    @Beta()
    @Deprecated()
    public static Command deleteCookie(java.lang.String cookieName, java.lang.String url) {
        java.util.Objects.requireNonNull(cookieName, "cookieName is required");
        java.util.Objects.requireNonNull(url, "url is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("cookieName", cookieName);
        params.put("url", url);
        return new Command<>("Page.deleteCookie", Map.copyOf(params));
    }

    /**
     * Disables page domain notifications.
     */
    public static Command disable() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.disable", Map.copyOf(params));
    }

    /**
     * Enables page domain notifications.
     */
    public static Command enable() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.enable", Map.copyOf(params));
    }

    public static class GetAppManifestResponse {

        private final java.lang.String url;

        private final java.util.List errors;

        private final java.util.Optional data;

        private final java.util.Optional parsed;

        public GetAppManifestResponse(java.lang.String url, java.util.List errors, java.util.Optional data, java.util.Optional parsed) {
            this.url = java.util.Objects.requireNonNull(url, "url is required");
            this.errors = java.util.Objects.requireNonNull(errors, "errors is required");
            this.data = data;
            this.parsed = parsed;
        }

        /**
         * Manifest location.
         */
        public java.lang.String getUrl() {
            return url;
        }

        public java.util.List getErrors() {
            return errors;
        }

        /**
         * Manifest content.
         */
        public java.util.Optional getData() {
            return data;
        }

        /**
         * Parsed manifest properties
         */
        public java.util.Optional getParsed() {
            return parsed;
        }

        private static GetAppManifestResponse fromJson(JsonInput input) {
            java.lang.String url = null;
            java.util.List errors = null;
            java.util.Optional data = java.util.Optional.empty();
            java.util.Optional parsed = java.util.Optional.empty();
            input.beginObject();
            while (input.hasNext()) {
                switch(input.nextName()) {
                    case "url":
                        url = input.nextString();
                        break;
                    case "errors":
                        errors = input.readArray(org.openqa.selenium.devtools.v120.page.model.AppManifestError.class);
                        break;
                    case "data":
                        data = java.util.Optional.ofNullable(input.nextString());
                        break;
                    case "parsed":
                        parsed = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v120.page.model.AppManifestParsedProperties.class));
                        break;
                    default:
                        input.skipValue();
                        break;
                }
            }
            input.endObject();
            return new GetAppManifestResponse(url, errors, data, parsed);
        }
    }

    public static Command getAppManifest() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.getAppManifest", Map.copyOf(params), input -> input.read(org.openqa.selenium.devtools.v120.page.Page.GetAppManifestResponse.class));
    }

    @Beta()
    public static Command> getInstallabilityErrors() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.getInstallabilityErrors", Map.copyOf(params), ConverterFunctions.map("installabilityErrors", input -> input.readArray(org.openqa.selenium.devtools.v120.page.model.InstallabilityError.class)));
    }

    /**
     * Deprecated because it's not guaranteed that the returned icon is in fact the one used for PWA installation.
     */
    @Beta()
    @Deprecated()
    public static Command getManifestIcons() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.getManifestIcons", Map.copyOf(params), ConverterFunctions.map("primaryIcon", java.lang.String.class));
    }

    public static class GetAppIdResponse {

        private final java.util.Optional appId;

        private final java.util.Optional recommendedId;

        public GetAppIdResponse(java.util.Optional appId, java.util.Optional recommendedId) {
            this.appId = appId;
            this.recommendedId = recommendedId;
        }

        /**
         * App id, either from manifest's id attribute or computed from start_url
         */
        public java.util.Optional getAppId() {
            return appId;
        }

        /**
         * Recommendation for manifest's id attribute to match current id computed from start_url
         */
        public java.util.Optional getRecommendedId() {
            return recommendedId;
        }

        private static GetAppIdResponse fromJson(JsonInput input) {
            java.util.Optional appId = java.util.Optional.empty();
            java.util.Optional recommendedId = java.util.Optional.empty();
            input.beginObject();
            while (input.hasNext()) {
                switch(input.nextName()) {
                    case "appId":
                        appId = java.util.Optional.ofNullable(input.nextString());
                        break;
                    case "recommendedId":
                        recommendedId = java.util.Optional.ofNullable(input.nextString());
                        break;
                    default:
                        input.skipValue();
                        break;
                }
            }
            input.endObject();
            return new GetAppIdResponse(appId, recommendedId);
        }
    }

    /**
     * Returns the unique (PWA) app id.
     * Only returns values if the feature flag 'WebAppEnableManifestId' is enabled
     */
    @Beta()
    public static Command getAppId() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.getAppId", Map.copyOf(params), input -> input.read(org.openqa.selenium.devtools.v120.page.Page.GetAppIdResponse.class));
    }

    @Beta()
    public static Command getAdScriptId(org.openqa.selenium.devtools.v120.page.model.FrameId frameId) {
        java.util.Objects.requireNonNull(frameId, "frameId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("frameId", frameId);
        return new Command<>("Page.getAdScriptId", Map.copyOf(params), ConverterFunctions.map("adScriptId", org.openqa.selenium.devtools.v120.page.model.AdScriptId.class));
    }

    /**
     * Returns all browser cookies for the page and all of its subframes. Depending
     * on the backend support, will return detailed cookie information in the
     * `cookies` field.
     */
    @Beta()
    @Deprecated()
    public static Command> getCookies() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.getCookies", Map.copyOf(params), ConverterFunctions.map("cookies", input -> input.readArray(org.openqa.selenium.devtools.v120.network.model.Cookie.class)));
    }

    /**
     * Returns present frame tree structure.
     */
    public static Command getFrameTree() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.getFrameTree", Map.copyOf(params), ConverterFunctions.map("frameTree", org.openqa.selenium.devtools.v120.page.model.FrameTree.class));
    }

    public static class GetLayoutMetricsResponse {

        private final org.openqa.selenium.devtools.v120.page.model.LayoutViewport layoutViewport;

        private final org.openqa.selenium.devtools.v120.page.model.VisualViewport visualViewport;

        private final org.openqa.selenium.devtools.v120.dom.model.Rect contentSize;

        private final org.openqa.selenium.devtools.v120.page.model.LayoutViewport cssLayoutViewport;

        private final org.openqa.selenium.devtools.v120.page.model.VisualViewport cssVisualViewport;

        private final org.openqa.selenium.devtools.v120.dom.model.Rect cssContentSize;

        public GetLayoutMetricsResponse(org.openqa.selenium.devtools.v120.page.model.LayoutViewport layoutViewport, org.openqa.selenium.devtools.v120.page.model.VisualViewport visualViewport, org.openqa.selenium.devtools.v120.dom.model.Rect contentSize, org.openqa.selenium.devtools.v120.page.model.LayoutViewport cssLayoutViewport, org.openqa.selenium.devtools.v120.page.model.VisualViewport cssVisualViewport, org.openqa.selenium.devtools.v120.dom.model.Rect cssContentSize) {
            this.layoutViewport = java.util.Objects.requireNonNull(layoutViewport, "layoutViewport is required");
            this.visualViewport = java.util.Objects.requireNonNull(visualViewport, "visualViewport is required");
            this.contentSize = java.util.Objects.requireNonNull(contentSize, "contentSize is required");
            this.cssLayoutViewport = java.util.Objects.requireNonNull(cssLayoutViewport, "cssLayoutViewport is required");
            this.cssVisualViewport = java.util.Objects.requireNonNull(cssVisualViewport, "cssVisualViewport is required");
            this.cssContentSize = java.util.Objects.requireNonNull(cssContentSize, "cssContentSize is required");
        }

        /**
         * Deprecated metrics relating to the layout viewport. Is in device pixels. Use `cssLayoutViewport` instead.
         */
        public org.openqa.selenium.devtools.v120.page.model.LayoutViewport getLayoutViewport() {
            return layoutViewport;
        }

        /**
         * Deprecated metrics relating to the visual viewport. Is in device pixels. Use `cssVisualViewport` instead.
         */
        public org.openqa.selenium.devtools.v120.page.model.VisualViewport getVisualViewport() {
            return visualViewport;
        }

        /**
         * Deprecated size of scrollable area. Is in DP. Use `cssContentSize` instead.
         */
        public org.openqa.selenium.devtools.v120.dom.model.Rect getContentSize() {
            return contentSize;
        }

        /**
         * Metrics relating to the layout viewport in CSS pixels.
         */
        public org.openqa.selenium.devtools.v120.page.model.LayoutViewport getCssLayoutViewport() {
            return cssLayoutViewport;
        }

        /**
         * Metrics relating to the visual viewport in CSS pixels.
         */
        public org.openqa.selenium.devtools.v120.page.model.VisualViewport getCssVisualViewport() {
            return cssVisualViewport;
        }

        /**
         * Size of scrollable area in CSS pixels.
         */
        public org.openqa.selenium.devtools.v120.dom.model.Rect getCssContentSize() {
            return cssContentSize;
        }

        private static GetLayoutMetricsResponse fromJson(JsonInput input) {
            org.openqa.selenium.devtools.v120.page.model.LayoutViewport layoutViewport = null;
            org.openqa.selenium.devtools.v120.page.model.VisualViewport visualViewport = null;
            org.openqa.selenium.devtools.v120.dom.model.Rect contentSize = null;
            org.openqa.selenium.devtools.v120.page.model.LayoutViewport cssLayoutViewport = null;
            org.openqa.selenium.devtools.v120.page.model.VisualViewport cssVisualViewport = null;
            org.openqa.selenium.devtools.v120.dom.model.Rect cssContentSize = null;
            input.beginObject();
            while (input.hasNext()) {
                switch(input.nextName()) {
                    case "layoutViewport":
                        layoutViewport = input.read(org.openqa.selenium.devtools.v120.page.model.LayoutViewport.class);
                        break;
                    case "visualViewport":
                        visualViewport = input.read(org.openqa.selenium.devtools.v120.page.model.VisualViewport.class);
                        break;
                    case "contentSize":
                        contentSize = input.read(org.openqa.selenium.devtools.v120.dom.model.Rect.class);
                        break;
                    case "cssLayoutViewport":
                        cssLayoutViewport = input.read(org.openqa.selenium.devtools.v120.page.model.LayoutViewport.class);
                        break;
                    case "cssVisualViewport":
                        cssVisualViewport = input.read(org.openqa.selenium.devtools.v120.page.model.VisualViewport.class);
                        break;
                    case "cssContentSize":
                        cssContentSize = input.read(org.openqa.selenium.devtools.v120.dom.model.Rect.class);
                        break;
                    default:
                        input.skipValue();
                        break;
                }
            }
            input.endObject();
            return new GetLayoutMetricsResponse(layoutViewport, visualViewport, contentSize, cssLayoutViewport, cssVisualViewport, cssContentSize);
        }
    }

    /**
     * Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
     */
    public static Command getLayoutMetrics() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.getLayoutMetrics", Map.copyOf(params), input -> input.read(org.openqa.selenium.devtools.v120.page.Page.GetLayoutMetricsResponse.class));
    }

    public static class GetNavigationHistoryResponse {

        private final java.lang.Integer currentIndex;

        private final java.util.List entries;

        public GetNavigationHistoryResponse(java.lang.Integer currentIndex, java.util.List entries) {
            this.currentIndex = java.util.Objects.requireNonNull(currentIndex, "currentIndex is required");
            this.entries = java.util.Objects.requireNonNull(entries, "entries is required");
        }

        /**
         * Index of the current navigation history entry.
         */
        public java.lang.Integer getCurrentIndex() {
            return currentIndex;
        }

        /**
         * Array of navigation history entries.
         */
        public java.util.List getEntries() {
            return entries;
        }

        private static GetNavigationHistoryResponse fromJson(JsonInput input) {
            java.lang.Integer currentIndex = 0;
            java.util.List entries = null;
            input.beginObject();
            while (input.hasNext()) {
                switch(input.nextName()) {
                    case "currentIndex":
                        currentIndex = input.nextNumber().intValue();
                        break;
                    case "entries":
                        entries = input.readArray(org.openqa.selenium.devtools.v120.page.model.NavigationEntry.class);
                        break;
                    default:
                        input.skipValue();
                        break;
                }
            }
            input.endObject();
            return new GetNavigationHistoryResponse(currentIndex, entries);
        }
    }

    /**
     * Returns navigation history for the current page.
     */
    public static Command getNavigationHistory() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.getNavigationHistory", Map.copyOf(params), input -> input.read(org.openqa.selenium.devtools.v120.page.Page.GetNavigationHistoryResponse.class));
    }

    /**
     * Resets navigation history for the current page.
     */
    public static Command resetNavigationHistory() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.resetNavigationHistory", Map.copyOf(params));
    }

    public static class GetResourceContentResponse {

        private final java.lang.String content;

        private final java.lang.Boolean base64Encoded;

        public GetResourceContentResponse(java.lang.String content, java.lang.Boolean base64Encoded) {
            this.content = java.util.Objects.requireNonNull(content, "content is required");
            this.base64Encoded = java.util.Objects.requireNonNull(base64Encoded, "base64Encoded is required");
        }

        /**
         * Resource content.
         */
        public java.lang.String getContent() {
            return content;
        }

        /**
         * True, if content was served as base64.
         */
        public java.lang.Boolean getBase64Encoded() {
            return base64Encoded;
        }

        private static GetResourceContentResponse fromJson(JsonInput input) {
            java.lang.String content = null;
            java.lang.Boolean base64Encoded = false;
            input.beginObject();
            while (input.hasNext()) {
                switch(input.nextName()) {
                    case "content":
                        content = input.nextString();
                        break;
                    case "base64Encoded":
                        base64Encoded = input.nextBoolean();
                        break;
                    default:
                        input.skipValue();
                        break;
                }
            }
            input.endObject();
            return new GetResourceContentResponse(content, base64Encoded);
        }
    }

    /**
     * Returns content of the given resource.
     */
    @Beta()
    public static Command getResourceContent(org.openqa.selenium.devtools.v120.page.model.FrameId frameId, java.lang.String url) {
        java.util.Objects.requireNonNull(frameId, "frameId is required");
        java.util.Objects.requireNonNull(url, "url is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("frameId", frameId);
        params.put("url", url);
        return new Command<>("Page.getResourceContent", Map.copyOf(params), input -> input.read(org.openqa.selenium.devtools.v120.page.Page.GetResourceContentResponse.class));
    }

    /**
     * Returns present frame / resource tree structure.
     */
    @Beta()
    public static Command getResourceTree() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.getResourceTree", Map.copyOf(params), ConverterFunctions.map("frameTree", org.openqa.selenium.devtools.v120.page.model.FrameResourceTree.class));
    }

    /**
     * Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
     */
    public static Command handleJavaScriptDialog(java.lang.Boolean accept, java.util.Optional promptText) {
        java.util.Objects.requireNonNull(accept, "accept is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("accept", accept);
        promptText.ifPresent(p -> params.put("promptText", p));
        return new Command<>("Page.handleJavaScriptDialog", Map.copyOf(params));
    }

    public static class NavigateResponse {

        private final org.openqa.selenium.devtools.v120.page.model.FrameId frameId;

        private final java.util.Optional loaderId;

        private final java.util.Optional errorText;

        public NavigateResponse(org.openqa.selenium.devtools.v120.page.model.FrameId frameId, java.util.Optional loaderId, java.util.Optional errorText) {
            this.frameId = java.util.Objects.requireNonNull(frameId, "frameId is required");
            this.loaderId = loaderId;
            this.errorText = errorText;
        }

        /**
         * Frame id that has navigated (or failed to navigate)
         */
        public org.openqa.selenium.devtools.v120.page.model.FrameId getFrameId() {
            return frameId;
        }

        /**
         * Loader identifier. This is omitted in case of same-document navigation,
         * as the previously committed loaderId would not change.
         */
        public java.util.Optional getLoaderId() {
            return loaderId;
        }

        /**
         * User friendly error message, present if and only if navigation has failed.
         */
        public java.util.Optional getErrorText() {
            return errorText;
        }

        private static NavigateResponse fromJson(JsonInput input) {
            org.openqa.selenium.devtools.v120.page.model.FrameId frameId = null;
            java.util.Optional loaderId = java.util.Optional.empty();
            java.util.Optional errorText = java.util.Optional.empty();
            input.beginObject();
            while (input.hasNext()) {
                switch(input.nextName()) {
                    case "frameId":
                        frameId = input.read(org.openqa.selenium.devtools.v120.page.model.FrameId.class);
                        break;
                    case "loaderId":
                        loaderId = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v120.network.model.LoaderId.class));
                        break;
                    case "errorText":
                        errorText = java.util.Optional.ofNullable(input.nextString());
                        break;
                    default:
                        input.skipValue();
                        break;
                }
            }
            input.endObject();
            return new NavigateResponse(frameId, loaderId, errorText);
        }
    }

    /**
     * Navigates current page to the given URL.
     */
    public static Command navigate(java.lang.String url, java.util.Optional referrer, java.util.Optional transitionType, java.util.Optional frameId, java.util.Optional referrerPolicy) {
        java.util.Objects.requireNonNull(url, "url is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("url", url);
        referrer.ifPresent(p -> params.put("referrer", p));
        transitionType.ifPresent(p -> params.put("transitionType", p));
        frameId.ifPresent(p -> params.put("frameId", p));
        referrerPolicy.ifPresent(p -> params.put("referrerPolicy", p));
        return new Command<>("Page.navigate", Map.copyOf(params), input -> input.read(org.openqa.selenium.devtools.v120.page.Page.NavigateResponse.class));
    }

    /**
     * Navigates current page to the given history entry.
     */
    public static Command navigateToHistoryEntry(java.lang.Integer entryId) {
        java.util.Objects.requireNonNull(entryId, "entryId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("entryId", entryId);
        return new Command<>("Page.navigateToHistoryEntry", Map.copyOf(params));
    }

    public static class PrintToPDFResponse {

        private final java.lang.String data;

        private final java.util.Optional stream;

        public PrintToPDFResponse(java.lang.String data, java.util.Optional stream) {
            this.data = java.util.Objects.requireNonNull(data, "data is required");
            this.stream = stream;
        }

        /**
         * Base64-encoded pdf data. Empty if |returnAsStream| is specified.
         */
        public java.lang.String getData() {
            return data;
        }

        /**
         * A handle of the stream that holds resulting PDF data.
         */
        public java.util.Optional getStream() {
            return stream;
        }

        private static PrintToPDFResponse fromJson(JsonInput input) {
            java.lang.String data = null;
            java.util.Optional stream = java.util.Optional.empty();
            input.beginObject();
            while (input.hasNext()) {
                switch(input.nextName()) {
                    case "data":
                        data = input.nextString();
                        break;
                    case "stream":
                        stream = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v120.io.model.StreamHandle.class));
                        break;
                    default:
                        input.skipValue();
                        break;
                }
            }
            input.endObject();
            return new PrintToPDFResponse(data, stream);
        }
    }

    public enum PrintToPDFTransferMode {

        RETURNASBASE64("ReturnAsBase64"), RETURNASSTREAM("ReturnAsStream");

        private String value;

        PrintToPDFTransferMode(String value) {
            this.value = value;
        }

        public static PrintToPDFTransferMode fromString(String s) {
            return java.util.Arrays.stream(PrintToPDFTransferMode.values()).filter(rs -> rs.value.equalsIgnoreCase(s)).findFirst().orElseThrow(() -> new org.openqa.selenium.devtools.DevToolsException("Given value " + s + " is not found within PrintToPDFTransferMode "));
        }

        public String toString() {
            return value;
        }

        public String toJson() {
            return value;
        }

        private static PrintToPDFTransferMode fromJson(JsonInput input) {
            return fromString(input.nextString());
        }
    }

    /**
     * Print page as PDF.
     */
    public static Command printToPDF(java.util.Optional landscape, java.util.Optional displayHeaderFooter, java.util.Optional printBackground, java.util.Optional scale, java.util.Optional paperWidth, java.util.Optional paperHeight, java.util.Optional marginTop, java.util.Optional marginBottom, java.util.Optional marginLeft, java.util.Optional marginRight, java.util.Optional pageRanges, java.util.Optional headerTemplate, java.util.Optional footerTemplate, java.util.Optional preferCSSPageSize, java.util.Optional transferMode, java.util.Optional generateTaggedPDF) {
        LinkedHashMap params = new LinkedHashMap<>();
        landscape.ifPresent(p -> params.put("landscape", p));
        displayHeaderFooter.ifPresent(p -> params.put("displayHeaderFooter", p));
        printBackground.ifPresent(p -> params.put("printBackground", p));
        scale.ifPresent(p -> params.put("scale", p));
        paperWidth.ifPresent(p -> params.put("paperWidth", p));
        paperHeight.ifPresent(p -> params.put("paperHeight", p));
        marginTop.ifPresent(p -> params.put("marginTop", p));
        marginBottom.ifPresent(p -> params.put("marginBottom", p));
        marginLeft.ifPresent(p -> params.put("marginLeft", p));
        marginRight.ifPresent(p -> params.put("marginRight", p));
        pageRanges.ifPresent(p -> params.put("pageRanges", p));
        headerTemplate.ifPresent(p -> params.put("headerTemplate", p));
        footerTemplate.ifPresent(p -> params.put("footerTemplate", p));
        preferCSSPageSize.ifPresent(p -> params.put("preferCSSPageSize", p));
        transferMode.ifPresent(p -> params.put("transferMode", p));
        generateTaggedPDF.ifPresent(p -> params.put("generateTaggedPDF", p));
        return new Command<>("Page.printToPDF", Map.copyOf(params), input -> input.read(org.openqa.selenium.devtools.v120.page.Page.PrintToPDFResponse.class));
    }

    /**
     * Reloads given page optionally ignoring the cache.
     */
    public static Command reload(java.util.Optional ignoreCache, java.util.Optional scriptToEvaluateOnLoad) {
        LinkedHashMap params = new LinkedHashMap<>();
        ignoreCache.ifPresent(p -> params.put("ignoreCache", p));
        scriptToEvaluateOnLoad.ifPresent(p -> params.put("scriptToEvaluateOnLoad", p));
        return new Command<>("Page.reload", Map.copyOf(params));
    }

    /**
     * Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
     */
    @Beta()
    @Deprecated()
    public static Command removeScriptToEvaluateOnLoad(org.openqa.selenium.devtools.v120.page.model.ScriptIdentifier identifier) {
        java.util.Objects.requireNonNull(identifier, "identifier is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("identifier", identifier);
        return new Command<>("Page.removeScriptToEvaluateOnLoad", Map.copyOf(params));
    }

    /**
     * Removes given script from the list.
     */
    public static Command removeScriptToEvaluateOnNewDocument(org.openqa.selenium.devtools.v120.page.model.ScriptIdentifier identifier) {
        java.util.Objects.requireNonNull(identifier, "identifier is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("identifier", identifier);
        return new Command<>("Page.removeScriptToEvaluateOnNewDocument", Map.copyOf(params));
    }

    /**
     * Acknowledges that a screencast frame has been received by the frontend.
     */
    @Beta()
    public static Command screencastFrameAck(java.lang.Integer sessionId) {
        java.util.Objects.requireNonNull(sessionId, "sessionId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("sessionId", sessionId);
        return new Command<>("Page.screencastFrameAck", Map.copyOf(params));
    }

    /**
     * Searches for given string in resource content.
     */
    @Beta()
    public static Command> searchInResource(org.openqa.selenium.devtools.v120.page.model.FrameId frameId, java.lang.String url, java.lang.String query, java.util.Optional caseSensitive, java.util.Optional isRegex) {
        java.util.Objects.requireNonNull(frameId, "frameId is required");
        java.util.Objects.requireNonNull(url, "url is required");
        java.util.Objects.requireNonNull(query, "query is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("frameId", frameId);
        params.put("url", url);
        params.put("query", query);
        caseSensitive.ifPresent(p -> params.put("caseSensitive", p));
        isRegex.ifPresent(p -> params.put("isRegex", p));
        return new Command<>("Page.searchInResource", Map.copyOf(params), ConverterFunctions.map("result", input -> input.readArray(org.openqa.selenium.devtools.v120.debugger.model.SearchMatch.class)));
    }

    /**
     * Enable Chrome's experimental ad filter on all sites.
     */
    @Beta()
    public static Command setAdBlockingEnabled(java.lang.Boolean enabled) {
        java.util.Objects.requireNonNull(enabled, "enabled is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("enabled", enabled);
        return new Command<>("Page.setAdBlockingEnabled", Map.copyOf(params));
    }

    /**
     * Enable page Content Security Policy by-passing.
     */
    @Beta()
    public static Command setBypassCSP(java.lang.Boolean enabled) {
        java.util.Objects.requireNonNull(enabled, "enabled is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("enabled", enabled);
        return new Command<>("Page.setBypassCSP", Map.copyOf(params));
    }

    /**
     * Get Permissions Policy state on given frame.
     */
    @Beta()
    public static Command> getPermissionsPolicyState(org.openqa.selenium.devtools.v120.page.model.FrameId frameId) {
        java.util.Objects.requireNonNull(frameId, "frameId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("frameId", frameId);
        return new Command<>("Page.getPermissionsPolicyState", Map.copyOf(params), ConverterFunctions.map("states", input -> input.readArray(org.openqa.selenium.devtools.v120.page.model.PermissionsPolicyFeatureState.class)));
    }

    /**
     * Get Origin Trials on given frame.
     */
    @Beta()
    public static Command> getOriginTrials(org.openqa.selenium.devtools.v120.page.model.FrameId frameId) {
        java.util.Objects.requireNonNull(frameId, "frameId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("frameId", frameId);
        return new Command<>("Page.getOriginTrials", Map.copyOf(params), ConverterFunctions.map("originTrials", input -> input.readArray(org.openqa.selenium.devtools.v120.page.model.OriginTrial.class)));
    }

    /**
     * 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).
     */
    @Beta()
    @Deprecated()
    public static Command setDeviceMetricsOverride(java.lang.Integer width, java.lang.Integer height, java.lang.Number deviceScaleFactor, java.lang.Boolean mobile, java.util.Optional scale, java.util.Optional screenWidth, java.util.Optional screenHeight, java.util.Optional positionX, java.util.Optional positionY, java.util.Optional dontSetVisibleSize, java.util.Optional screenOrientation, java.util.Optional viewport) {
        java.util.Objects.requireNonNull(width, "width is required");
        java.util.Objects.requireNonNull(height, "height is required");
        java.util.Objects.requireNonNull(deviceScaleFactor, "deviceScaleFactor is required");
        java.util.Objects.requireNonNull(mobile, "mobile is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("width", width);
        params.put("height", height);
        params.put("deviceScaleFactor", deviceScaleFactor);
        params.put("mobile", mobile);
        scale.ifPresent(p -> params.put("scale", p));
        screenWidth.ifPresent(p -> params.put("screenWidth", p));
        screenHeight.ifPresent(p -> params.put("screenHeight", p));
        positionX.ifPresent(p -> params.put("positionX", p));
        positionY.ifPresent(p -> params.put("positionY", p));
        dontSetVisibleSize.ifPresent(p -> params.put("dontSetVisibleSize", p));
        screenOrientation.ifPresent(p -> params.put("screenOrientation", p));
        viewport.ifPresent(p -> params.put("viewport", p));
        return new Command<>("Page.setDeviceMetricsOverride", Map.copyOf(params));
    }

    /**
     * Overrides the Device Orientation.
     */
    @Beta()
    @Deprecated()
    public static Command setDeviceOrientationOverride(java.lang.Number alpha, java.lang.Number beta, java.lang.Number gamma) {
        java.util.Objects.requireNonNull(alpha, "alpha is required");
        java.util.Objects.requireNonNull(beta, "beta is required");
        java.util.Objects.requireNonNull(gamma, "gamma is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("alpha", alpha);
        params.put("beta", beta);
        params.put("gamma", gamma);
        return new Command<>("Page.setDeviceOrientationOverride", Map.copyOf(params));
    }

    /**
     * Set generic font families.
     */
    @Beta()
    public static Command setFontFamilies(org.openqa.selenium.devtools.v120.page.model.FontFamilies fontFamilies, java.util.Optional> forScripts) {
        java.util.Objects.requireNonNull(fontFamilies, "fontFamilies is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("fontFamilies", fontFamilies);
        forScripts.ifPresent(p -> params.put("forScripts", p));
        return new Command<>("Page.setFontFamilies", Map.copyOf(params));
    }

    /**
     * Set default font sizes.
     */
    @Beta()
    public static Command setFontSizes(org.openqa.selenium.devtools.v120.page.model.FontSizes fontSizes) {
        java.util.Objects.requireNonNull(fontSizes, "fontSizes is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("fontSizes", fontSizes);
        return new Command<>("Page.setFontSizes", Map.copyOf(params));
    }

    /**
     * Sets given markup as the document's HTML.
     */
    public static Command setDocumentContent(org.openqa.selenium.devtools.v120.page.model.FrameId frameId, java.lang.String html) {
        java.util.Objects.requireNonNull(frameId, "frameId is required");
        java.util.Objects.requireNonNull(html, "html is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("frameId", frameId);
        params.put("html", html);
        return new Command<>("Page.setDocumentContent", Map.copyOf(params));
    }

    public enum SetDownloadBehaviorBehavior {

        DENY("deny"), ALLOW("allow"), DEFAULT("default");

        private String value;

        SetDownloadBehaviorBehavior(String value) {
            this.value = value;
        }

        public static SetDownloadBehaviorBehavior fromString(String s) {
            return java.util.Arrays.stream(SetDownloadBehaviorBehavior.values()).filter(rs -> rs.value.equalsIgnoreCase(s)).findFirst().orElseThrow(() -> new org.openqa.selenium.devtools.DevToolsException("Given value " + s + " is not found within SetDownloadBehaviorBehavior "));
        }

        public String toString() {
            return value;
        }

        public String toJson() {
            return value;
        }

        private static SetDownloadBehaviorBehavior fromJson(JsonInput input) {
            return fromString(input.nextString());
        }
    }

    /**
     * Set the behavior when downloading a file.
     */
    @Beta()
    @Deprecated()
    public static Command setDownloadBehavior(SetDownloadBehaviorBehavior behavior, java.util.Optional downloadPath) {
        java.util.Objects.requireNonNull(behavior, "behavior is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("behavior", behavior);
        downloadPath.ifPresent(p -> params.put("downloadPath", p));
        return new Command<>("Page.setDownloadBehavior", Map.copyOf(params));
    }

    /**
     * Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position
     * unavailable.
     */
    @Deprecated()
    public static Command setGeolocationOverride(java.util.Optional latitude, java.util.Optional longitude, java.util.Optional accuracy) {
        LinkedHashMap params = new LinkedHashMap<>();
        latitude.ifPresent(p -> params.put("latitude", p));
        longitude.ifPresent(p -> params.put("longitude", p));
        accuracy.ifPresent(p -> params.put("accuracy", p));
        return new Command<>("Page.setGeolocationOverride", Map.copyOf(params));
    }

    /**
     * Controls whether page will emit lifecycle events.
     */
    @Beta()
    public static Command setLifecycleEventsEnabled(java.lang.Boolean enabled) {
        java.util.Objects.requireNonNull(enabled, "enabled is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("enabled", enabled);
        return new Command<>("Page.setLifecycleEventsEnabled", Map.copyOf(params));
    }

    public enum SetTouchEmulationEnabledConfiguration {

        MOBILE("mobile"), DESKTOP("desktop");

        private String value;

        SetTouchEmulationEnabledConfiguration(String value) {
            this.value = value;
        }

        public static SetTouchEmulationEnabledConfiguration fromString(String s) {
            return java.util.Arrays.stream(SetTouchEmulationEnabledConfiguration.values()).filter(rs -> rs.value.equalsIgnoreCase(s)).findFirst().orElseThrow(() -> new org.openqa.selenium.devtools.DevToolsException("Given value " + s + " is not found within SetTouchEmulationEnabledConfiguration "));
        }

        public String toString() {
            return value;
        }

        public String toJson() {
            return value;
        }

        private static SetTouchEmulationEnabledConfiguration fromJson(JsonInput input) {
            return fromString(input.nextString());
        }
    }

    /**
     * Toggles mouse event-based touch event emulation.
     */
    @Beta()
    @Deprecated()
    public static Command setTouchEmulationEnabled(java.lang.Boolean enabled, java.util.Optional configuration) {
        java.util.Objects.requireNonNull(enabled, "enabled is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("enabled", enabled);
        configuration.ifPresent(p -> params.put("configuration", p));
        return new Command<>("Page.setTouchEmulationEnabled", Map.copyOf(params));
    }

    public enum StartScreencastFormat {

        JPEG("jpeg"), PNG("png");

        private String value;

        StartScreencastFormat(String value) {
            this.value = value;
        }

        public static StartScreencastFormat fromString(String s) {
            return java.util.Arrays.stream(StartScreencastFormat.values()).filter(rs -> rs.value.equalsIgnoreCase(s)).findFirst().orElseThrow(() -> new org.openqa.selenium.devtools.DevToolsException("Given value " + s + " is not found within StartScreencastFormat "));
        }

        public String toString() {
            return value;
        }

        public String toJson() {
            return value;
        }

        private static StartScreencastFormat fromJson(JsonInput input) {
            return fromString(input.nextString());
        }
    }

    /**
     * Starts sending each frame using the `screencastFrame` event.
     */
    @Beta()
    public static Command startScreencast(java.util.Optional format, java.util.Optional quality, java.util.Optional maxWidth, java.util.Optional maxHeight, java.util.Optional everyNthFrame) {
        LinkedHashMap params = new LinkedHashMap<>();
        format.ifPresent(p -> params.put("format", p));
        quality.ifPresent(p -> params.put("quality", p));
        maxWidth.ifPresent(p -> params.put("maxWidth", p));
        maxHeight.ifPresent(p -> params.put("maxHeight", p));
        everyNthFrame.ifPresent(p -> params.put("everyNthFrame", p));
        return new Command<>("Page.startScreencast", Map.copyOf(params));
    }

    /**
     * Force the page stop all navigations and pending resource fetches.
     */
    public static Command stopLoading() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.stopLoading", Map.copyOf(params));
    }

    /**
     * Crashes renderer on the IO thread, generates minidumps.
     */
    @Beta()
    public static Command crash() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.crash", Map.copyOf(params));
    }

    /**
     * Tries to close page, running its beforeunload hooks, if any.
     */
    @Beta()
    public static Command close() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.close", Map.copyOf(params));
    }

    public enum SetWebLifecycleStateState {

        FROZEN("frozen"), ACTIVE("active");

        private String value;

        SetWebLifecycleStateState(String value) {
            this.value = value;
        }

        public static SetWebLifecycleStateState fromString(String s) {
            return java.util.Arrays.stream(SetWebLifecycleStateState.values()).filter(rs -> rs.value.equalsIgnoreCase(s)).findFirst().orElseThrow(() -> new org.openqa.selenium.devtools.DevToolsException("Given value " + s + " is not found within SetWebLifecycleStateState "));
        }

        public String toString() {
            return value;
        }

        public String toJson() {
            return value;
        }

        private static SetWebLifecycleStateState fromJson(JsonInput input) {
            return fromString(input.nextString());
        }
    }

    /**
     * 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/
     */
    @Beta()
    public static Command setWebLifecycleState(SetWebLifecycleStateState state) {
        java.util.Objects.requireNonNull(state, "state is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("state", state);
        return new Command<>("Page.setWebLifecycleState", Map.copyOf(params));
    }

    /**
     * Stops sending each frame in the `screencastFrame`.
     */
    @Beta()
    public static Command stopScreencast() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.stopScreencast", Map.copyOf(params));
    }

    /**
     * Requests backend to produce compilation cache for the specified scripts.
     * `scripts` are appeneded 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`.
     */
    @Beta()
    public static Command produceCompilationCache(java.util.List scripts) {
        java.util.Objects.requireNonNull(scripts, "scripts is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("scripts", scripts);
        return new Command<>("Page.produceCompilationCache", Map.copyOf(params));
    }

    /**
     * Seeds compilation cache for given url. Compilation cache does not survive
     * cross-process navigation.
     */
    @Beta()
    public static Command addCompilationCache(java.lang.String url, java.lang.String data) {
        java.util.Objects.requireNonNull(url, "url is required");
        java.util.Objects.requireNonNull(data, "data is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("url", url);
        params.put("data", data);
        return new Command<>("Page.addCompilationCache", Map.copyOf(params));
    }

    /**
     * Clears seeded compilation cache.
     */
    @Beta()
    public static Command clearCompilationCache() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.clearCompilationCache", Map.copyOf(params));
    }

    /**
     * Sets the Secure Payment Confirmation transaction mode.
     * https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode
     */
    @Beta()
    public static Command setSPCTransactionMode(org.openqa.selenium.devtools.v120.page.model.AutoResponseMode mode) {
        java.util.Objects.requireNonNull(mode, "mode is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("mode", mode);
        return new Command<>("Page.setSPCTransactionMode", Map.copyOf(params));
    }

    /**
     * Extensions for Custom Handlers API:
     * https://html.spec.whatwg.org/multipage/system-state.html#rph-automation
     */
    @Beta()
    public static Command setRPHRegistrationMode(org.openqa.selenium.devtools.v120.page.model.AutoResponseMode mode) {
        java.util.Objects.requireNonNull(mode, "mode is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("mode", mode);
        return new Command<>("Page.setRPHRegistrationMode", Map.copyOf(params));
    }

    /**
     * Generates a report for testing.
     */
    @Beta()
    public static Command generateTestReport(java.lang.String message, java.util.Optional group) {
        java.util.Objects.requireNonNull(message, "message is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("message", message);
        group.ifPresent(p -> params.put("group", p));
        return new Command<>("Page.generateTestReport", Map.copyOf(params));
    }

    /**
     * Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.
     */
    @Beta()
    public static Command waitForDebugger() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Page.waitForDebugger", Map.copyOf(params));
    }

    /**
     * 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.
     */
    @Beta()
    public static Command setInterceptFileChooserDialog(java.lang.Boolean enabled) {
        java.util.Objects.requireNonNull(enabled, "enabled is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("enabled", enabled);
        return new Command<>("Page.setInterceptFileChooserDialog", Map.copyOf(params));
    }

    /**
     * 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.
     */
    @Beta()
    public static Command setPrerenderingAllowed(java.lang.Boolean isAllowed) {
        java.util.Objects.requireNonNull(isAllowed, "isAllowed is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("isAllowed", isAllowed);
        return new Command<>("Page.setPrerenderingAllowed", Map.copyOf(params));
    }

    public static Event domContentEventFired() {
        return new Event<>("Page.domContentEventFired", ConverterFunctions.map("timestamp", org.openqa.selenium.devtools.v120.network.model.MonotonicTime.class));
    }

    public static Event fileChooserOpened() {
        return new Event<>("Page.fileChooserOpened", input -> input.read(org.openqa.selenium.devtools.v120.page.model.FileChooserOpened.class));
    }

    public static Event frameAttached() {
        return new Event<>("Page.frameAttached", input -> input.read(org.openqa.selenium.devtools.v120.page.model.FrameAttached.class));
    }

    public static Event frameClearedScheduledNavigation() {
        return new Event<>("Page.frameClearedScheduledNavigation", ConverterFunctions.map("frameId", org.openqa.selenium.devtools.v120.page.model.FrameId.class));
    }

    public static Event frameDetached() {
        return new Event<>("Page.frameDetached", input -> input.read(org.openqa.selenium.devtools.v120.page.model.FrameDetached.class));
    }

    public static Event frameNavigated() {
        return new Event<>("Page.frameNavigated", input -> input.read(org.openqa.selenium.devtools.v120.page.model.FrameNavigated.class));
    }

    public static Event documentOpened() {
        return new Event<>("Page.documentOpened", ConverterFunctions.map("frame", org.openqa.selenium.devtools.v120.page.model.Frame.class));
    }

    public static Event frameResized() {
        return new Event<>("Page.frameResized", ConverterFunctions.empty());
    }

    public static Event frameRequestedNavigation() {
        return new Event<>("Page.frameRequestedNavigation", input -> input.read(org.openqa.selenium.devtools.v120.page.model.FrameRequestedNavigation.class));
    }

    public static Event frameScheduledNavigation() {
        return new Event<>("Page.frameScheduledNavigation", input -> input.read(org.openqa.selenium.devtools.v120.page.model.FrameScheduledNavigation.class));
    }

    public static Event frameStartedLoading() {
        return new Event<>("Page.frameStartedLoading", ConverterFunctions.map("frameId", org.openqa.selenium.devtools.v120.page.model.FrameId.class));
    }

    public static Event frameStoppedLoading() {
        return new Event<>("Page.frameStoppedLoading", ConverterFunctions.map("frameId", org.openqa.selenium.devtools.v120.page.model.FrameId.class));
    }

    public static Event downloadWillBegin() {
        return new Event<>("Page.downloadWillBegin", input -> input.read(org.openqa.selenium.devtools.v120.page.model.DownloadWillBegin.class));
    }

    public static Event downloadProgress() {
        return new Event<>("Page.downloadProgress", input -> input.read(org.openqa.selenium.devtools.v120.page.model.DownloadProgress.class));
    }

    public static Event interstitialHidden() {
        return new Event<>("Page.interstitialHidden", ConverterFunctions.empty());
    }

    public static Event interstitialShown() {
        return new Event<>("Page.interstitialShown", ConverterFunctions.empty());
    }

    public static Event javascriptDialogClosed() {
        return new Event<>("Page.javascriptDialogClosed", input -> input.read(org.openqa.selenium.devtools.v120.page.model.JavascriptDialogClosed.class));
    }

    public static Event javascriptDialogOpening() {
        return new Event<>("Page.javascriptDialogOpening", input -> input.read(org.openqa.selenium.devtools.v120.page.model.JavascriptDialogOpening.class));
    }

    public static Event lifecycleEvent() {
        return new Event<>("Page.lifecycleEvent", input -> input.read(org.openqa.selenium.devtools.v120.page.model.LifecycleEvent.class));
    }

    public static Event backForwardCacheNotUsed() {
        return new Event<>("Page.backForwardCacheNotUsed", input -> input.read(org.openqa.selenium.devtools.v120.page.model.BackForwardCacheNotUsed.class));
    }

    public static Event loadEventFired() {
        return new Event<>("Page.loadEventFired", ConverterFunctions.map("timestamp", org.openqa.selenium.devtools.v120.network.model.MonotonicTime.class));
    }

    public static Event navigatedWithinDocument() {
        return new Event<>("Page.navigatedWithinDocument", input -> input.read(org.openqa.selenium.devtools.v120.page.model.NavigatedWithinDocument.class));
    }

    public static Event screencastFrame() {
        return new Event<>("Page.screencastFrame", input -> input.read(org.openqa.selenium.devtools.v120.page.model.ScreencastFrame.class));
    }

    public static Event screencastVisibilityChanged() {
        return new Event<>("Page.screencastVisibilityChanged", ConverterFunctions.map("visible", java.lang.Boolean.class));
    }

    public static Event windowOpen() {
        return new Event<>("Page.windowOpen", input -> input.read(org.openqa.selenium.devtools.v120.page.model.WindowOpen.class));
    }

    public static Event compilationCacheProduced() {
        return new Event<>("Page.compilationCacheProduced", input -> input.read(org.openqa.selenium.devtools.v120.page.model.CompilationCacheProduced.class));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy