org.openqa.selenium.devtools.v85.page.Page Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-devtools-v85 Show documentation
Show all versions of selenium-devtools-v85 Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
package org.openqa.selenium.devtools.v85.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.v85.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.Objects.requireNonNull(source, "source is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("source", source);
worldName.ifPresent(p -> params.put("worldName", p));
return new Command<>("Page.addScriptToEvaluateOnNewDocument", Map.copyOf(params), ConverterFunctions.map("identifier", org.openqa.selenium.devtools.v85.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");
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) {
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));
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.v85.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.v85.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.v85.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.v85.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.v85.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.v85.page.model.InstallabilityError.class)));
}
@Beta()
public static Command getManifestIcons() {
LinkedHashMap params = new LinkedHashMap<>();
return new Command<>("Page.getManifestIcons", Map.copyOf(params), ConverterFunctions.map("primaryIcon", java.lang.String.class));
}
/**
* Returns all browser cookies. 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.v85.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.v85.page.model.FrameTree.class));
}
public static class GetLayoutMetricsResponse {
private final org.openqa.selenium.devtools.v85.page.model.LayoutViewport layoutViewport;
private final org.openqa.selenium.devtools.v85.page.model.VisualViewport visualViewport;
private final org.openqa.selenium.devtools.v85.dom.model.Rect contentSize;
public GetLayoutMetricsResponse(org.openqa.selenium.devtools.v85.page.model.LayoutViewport layoutViewport, org.openqa.selenium.devtools.v85.page.model.VisualViewport visualViewport, org.openqa.selenium.devtools.v85.dom.model.Rect contentSize) {
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");
}
/**
* Metrics relating to the layout viewport.
*/
public org.openqa.selenium.devtools.v85.page.model.LayoutViewport getLayoutViewport() {
return layoutViewport;
}
/**
* Metrics relating to the visual viewport.
*/
public org.openqa.selenium.devtools.v85.page.model.VisualViewport getVisualViewport() {
return visualViewport;
}
/**
* Size of scrollable area.
*/
public org.openqa.selenium.devtools.v85.dom.model.Rect getContentSize() {
return contentSize;
}
private static GetLayoutMetricsResponse fromJson(JsonInput input) {
org.openqa.selenium.devtools.v85.page.model.LayoutViewport layoutViewport = null;
org.openqa.selenium.devtools.v85.page.model.VisualViewport visualViewport = null;
org.openqa.selenium.devtools.v85.dom.model.Rect contentSize = null;
input.beginObject();
while (input.hasNext()) {
switch(input.nextName()) {
case "layoutViewport":
layoutViewport = input.read(org.openqa.selenium.devtools.v85.page.model.LayoutViewport.class);
break;
case "visualViewport":
visualViewport = input.read(org.openqa.selenium.devtools.v85.page.model.VisualViewport.class);
break;
case "contentSize":
contentSize = input.read(org.openqa.selenium.devtools.v85.dom.model.Rect.class);
break;
default:
input.skipValue();
break;
}
}
input.endObject();
return new GetLayoutMetricsResponse(layoutViewport, visualViewport, contentSize);
}
}
/**
* 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.v85.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.v85.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.v85.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.v85.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.v85.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.v85.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.v85.page.model.FrameId frameId;
private final java.util.Optional loaderId;
private final java.util.Optional errorText;
public NavigateResponse(org.openqa.selenium.devtools.v85.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.v85.page.model.FrameId getFrameId() {
return frameId;
}
/**
* Loader identifier.
*/
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.v85.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.v85.page.model.FrameId.class);
break;
case "loaderId":
loaderId = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v85.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.v85.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.v85.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 ignoreInvalidPageRanges, java.util.Optional headerTemplate, java.util.Optional footerTemplate, java.util.Optional preferCSSPageSize, java.util.Optional transferMode) {
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));
ignoreInvalidPageRanges.ifPresent(p -> params.put("ignoreInvalidPageRanges", 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));
return new Command<>("Page.printToPDF", Map.copyOf(params), input -> input.read(org.openqa.selenium.devtools.v85.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.v85.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.v85.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.v85.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.v85.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));
}
/**
* 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.v85.page.model.FontFamilies fontFamilies) {
java.util.Objects.requireNonNull(fontFamilies, "fontFamilies is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("fontFamilies", fontFamilies);
return new Command<>("Page.setFontFamilies", Map.copyOf(params));
}
/**
* Set default font sizes.
*/
@Beta()
public static Command setFontSizes(org.openqa.selenium.devtools.v85.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.v85.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));
}
/**
* Forces compilation cache to be generated for every subresource script.
*/
@Beta()
public static Command setProduceCompilationCache(java.lang.Boolean enabled) {
java.util.Objects.requireNonNull(enabled, "enabled is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("enabled", enabled);
return new Command<>("Page.setProduceCompilationCache", 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));
}
/**
* 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));
}
public static Event domContentEventFired() {
return new Event<>("Page.domContentEventFired", ConverterFunctions.map("timestamp", org.openqa.selenium.devtools.v85.network.model.MonotonicTime.class));
}
public static Event fileChooserOpened() {
return new Event<>("Page.fileChooserOpened", input -> input.read(org.openqa.selenium.devtools.v85.page.model.FileChooserOpened.class));
}
public static Event frameAttached() {
return new Event<>("Page.frameAttached", input -> input.read(org.openqa.selenium.devtools.v85.page.model.FrameAttached.class));
}
public static Event frameClearedScheduledNavigation() {
return new Event<>("Page.frameClearedScheduledNavigation", ConverterFunctions.map("frameId", org.openqa.selenium.devtools.v85.page.model.FrameId.class));
}
public static Event frameDetached() {
return new Event<>("Page.frameDetached", ConverterFunctions.map("frameId", org.openqa.selenium.devtools.v85.page.model.FrameId.class));
}
public static Event frameNavigated() {
return new Event<>("Page.frameNavigated", ConverterFunctions.map("frame", org.openqa.selenium.devtools.v85.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.v85.page.model.FrameRequestedNavigation.class));
}
public static Event frameScheduledNavigation() {
return new Event<>("Page.frameScheduledNavigation", input -> input.read(org.openqa.selenium.devtools.v85.page.model.FrameScheduledNavigation.class));
}
public static Event frameStartedLoading() {
return new Event<>("Page.frameStartedLoading", ConverterFunctions.map("frameId", org.openqa.selenium.devtools.v85.page.model.FrameId.class));
}
public static Event frameStoppedLoading() {
return new Event<>("Page.frameStoppedLoading", ConverterFunctions.map("frameId", org.openqa.selenium.devtools.v85.page.model.FrameId.class));
}
public static Event downloadWillBegin() {
return new Event<>("Page.downloadWillBegin", input -> input.read(org.openqa.selenium.devtools.v85.page.model.DownloadWillBegin.class));
}
public static Event downloadProgress() {
return new Event<>("Page.downloadProgress", input -> input.read(org.openqa.selenium.devtools.v85.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.v85.page.model.JavascriptDialogClosed.class));
}
public static Event javascriptDialogOpening() {
return new Event<>("Page.javascriptDialogOpening", input -> input.read(org.openqa.selenium.devtools.v85.page.model.JavascriptDialogOpening.class));
}
public static Event lifecycleEvent() {
return new Event<>("Page.lifecycleEvent", input -> input.read(org.openqa.selenium.devtools.v85.page.model.LifecycleEvent.class));
}
public static Event loadEventFired() {
return new Event<>("Page.loadEventFired", ConverterFunctions.map("timestamp", org.openqa.selenium.devtools.v85.network.model.MonotonicTime.class));
}
public static Event navigatedWithinDocument() {
return new Event<>("Page.navigatedWithinDocument", input -> input.read(org.openqa.selenium.devtools.v85.page.model.NavigatedWithinDocument.class));
}
public static Event screencastFrame() {
return new Event<>("Page.screencastFrame", input -> input.read(org.openqa.selenium.devtools.v85.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.v85.page.model.WindowOpen.class));
}
public static Event compilationCacheProduced() {
return new Event<>("Page.compilationCacheProduced", input -> input.read(org.openqa.selenium.devtools.v85.page.model.CompilationCacheProduced.class));
}
}