org.openqa.selenium.devtools.v122.overlay.Overlay Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-devtools-v122 Show documentation
Show all versions of selenium-devtools-v122 Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
package org.openqa.selenium.devtools.v122.overlay;
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;
/**
* This domain provides various functionality related to drawing atop the inspected page.
*/
@Beta()
public class Overlay {
/**
* Disables domain notifications.
*/
public static Command disable() {
LinkedHashMap params = new LinkedHashMap<>();
return new Command<>("Overlay.disable", Map.copyOf(params));
}
/**
* Enables domain notifications.
*/
public static Command enable() {
LinkedHashMap params = new LinkedHashMap<>();
return new Command<>("Overlay.enable", Map.copyOf(params));
}
/**
* For testing.
*/
public static Command> getHighlightObjectForTest(org.openqa.selenium.devtools.v122.dom.model.NodeId nodeId, java.util.Optional includeDistance, java.util.Optional includeStyle, java.util.Optional colorFormat, java.util.Optional showAccessibilityInfo) {
java.util.Objects.requireNonNull(nodeId, "nodeId is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("nodeId", nodeId);
includeDistance.ifPresent(p -> params.put("includeDistance", p));
includeStyle.ifPresent(p -> params.put("includeStyle", p));
colorFormat.ifPresent(p -> params.put("colorFormat", p));
showAccessibilityInfo.ifPresent(p -> params.put("showAccessibilityInfo", p));
return new Command<>("Overlay.getHighlightObjectForTest", Map.copyOf(params), ConverterFunctions.map("highlight", java.util.Map.class));
}
/**
* For Persistent Grid testing.
*/
public static Command> getGridHighlightObjectsForTest(java.util.List nodeIds) {
java.util.Objects.requireNonNull(nodeIds, "nodeIds is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("nodeIds", nodeIds);
return new Command<>("Overlay.getGridHighlightObjectsForTest", Map.copyOf(params), ConverterFunctions.map("highlights", java.util.Map.class));
}
/**
* For Source Order Viewer testing.
*/
public static Command> getSourceOrderHighlightObjectForTest(org.openqa.selenium.devtools.v122.dom.model.NodeId nodeId) {
java.util.Objects.requireNonNull(nodeId, "nodeId is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("nodeId", nodeId);
return new Command<>("Overlay.getSourceOrderHighlightObjectForTest", Map.copyOf(params), ConverterFunctions.map("highlight", java.util.Map.class));
}
/**
* Hides any highlight.
*/
public static Command hideHighlight() {
LinkedHashMap params = new LinkedHashMap<>();
return new Command<>("Overlay.hideHighlight", Map.copyOf(params));
}
/**
* Highlights owner element of the frame with given id.
* Deprecated: Doesn't work reliablity and cannot be fixed due to process
* separatation (the owner node might be in a different process). Determine
* the owner node in the client and use highlightNode.
*/
@Deprecated()
public static Command highlightFrame(org.openqa.selenium.devtools.v122.page.model.FrameId frameId, java.util.Optional contentColor, java.util.Optional contentOutlineColor) {
java.util.Objects.requireNonNull(frameId, "frameId is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("frameId", frameId);
contentColor.ifPresent(p -> params.put("contentColor", p));
contentOutlineColor.ifPresent(p -> params.put("contentOutlineColor", p));
return new Command<>("Overlay.highlightFrame", Map.copyOf(params));
}
/**
* Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or
* objectId must be specified.
*/
public static Command highlightNode(org.openqa.selenium.devtools.v122.overlay.model.HighlightConfig highlightConfig, java.util.Optional nodeId, java.util.Optional backendNodeId, java.util.Optional objectId, java.util.Optional selector) {
java.util.Objects.requireNonNull(highlightConfig, "highlightConfig is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("highlightConfig", highlightConfig);
nodeId.ifPresent(p -> params.put("nodeId", p));
backendNodeId.ifPresent(p -> params.put("backendNodeId", p));
objectId.ifPresent(p -> params.put("objectId", p));
selector.ifPresent(p -> params.put("selector", p));
return new Command<>("Overlay.highlightNode", Map.copyOf(params));
}
/**
* Highlights given quad. Coordinates are absolute with respect to the main frame viewport.
*/
public static Command highlightQuad(org.openqa.selenium.devtools.v122.dom.model.Quad quad, java.util.Optional color, java.util.Optional outlineColor) {
java.util.Objects.requireNonNull(quad, "quad is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("quad", quad);
color.ifPresent(p -> params.put("color", p));
outlineColor.ifPresent(p -> params.put("outlineColor", p));
return new Command<>("Overlay.highlightQuad", Map.copyOf(params));
}
/**
* Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.
*/
public static Command highlightRect(java.lang.Integer x, java.lang.Integer y, java.lang.Integer width, java.lang.Integer height, java.util.Optional color, java.util.Optional outlineColor) {
java.util.Objects.requireNonNull(x, "x is required");
java.util.Objects.requireNonNull(y, "y is required");
java.util.Objects.requireNonNull(width, "width is required");
java.util.Objects.requireNonNull(height, "height is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("x", x);
params.put("y", y);
params.put("width", width);
params.put("height", height);
color.ifPresent(p -> params.put("color", p));
outlineColor.ifPresent(p -> params.put("outlineColor", p));
return new Command<>("Overlay.highlightRect", Map.copyOf(params));
}
/**
* Highlights the source order of the children of the DOM node with given id or with the given
* JavaScript object wrapper. Either nodeId or objectId must be specified.
*/
public static Command highlightSourceOrder(org.openqa.selenium.devtools.v122.overlay.model.SourceOrderConfig sourceOrderConfig, java.util.Optional nodeId, java.util.Optional backendNodeId, java.util.Optional objectId) {
java.util.Objects.requireNonNull(sourceOrderConfig, "sourceOrderConfig is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("sourceOrderConfig", sourceOrderConfig);
nodeId.ifPresent(p -> params.put("nodeId", p));
backendNodeId.ifPresent(p -> params.put("backendNodeId", p));
objectId.ifPresent(p -> params.put("objectId", p));
return new Command<>("Overlay.highlightSourceOrder", Map.copyOf(params));
}
/**
* Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted.
* Backend then generates 'inspectNodeRequested' event upon element selection.
*/
public static Command setInspectMode(org.openqa.selenium.devtools.v122.overlay.model.InspectMode mode, java.util.Optional highlightConfig) {
java.util.Objects.requireNonNull(mode, "mode is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("mode", mode);
highlightConfig.ifPresent(p -> params.put("highlightConfig", p));
return new Command<>("Overlay.setInspectMode", Map.copyOf(params));
}
/**
* Highlights owner element of all frames detected to be ads.
*/
public static Command setShowAdHighlights(java.lang.Boolean show) {
java.util.Objects.requireNonNull(show, "show is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("show", show);
return new Command<>("Overlay.setShowAdHighlights", Map.copyOf(params));
}
public static Command setPausedInDebuggerMessage(java.util.Optional message) {
LinkedHashMap params = new LinkedHashMap<>();
message.ifPresent(p -> params.put("message", p));
return new Command<>("Overlay.setPausedInDebuggerMessage", Map.copyOf(params));
}
/**
* Requests that backend shows debug borders on layers
*/
public static Command setShowDebugBorders(java.lang.Boolean show) {
java.util.Objects.requireNonNull(show, "show is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("show", show);
return new Command<>("Overlay.setShowDebugBorders", Map.copyOf(params));
}
/**
* Requests that backend shows the FPS counter
*/
public static Command setShowFPSCounter(java.lang.Boolean show) {
java.util.Objects.requireNonNull(show, "show is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("show", show);
return new Command<>("Overlay.setShowFPSCounter", Map.copyOf(params));
}
/**
* Highlight multiple elements with the CSS Grid overlay.
*/
public static Command setShowGridOverlays(java.util.List gridNodeHighlightConfigs) {
java.util.Objects.requireNonNull(gridNodeHighlightConfigs, "gridNodeHighlightConfigs is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("gridNodeHighlightConfigs", gridNodeHighlightConfigs);
return new Command<>("Overlay.setShowGridOverlays", Map.copyOf(params));
}
public static Command setShowFlexOverlays(java.util.List flexNodeHighlightConfigs) {
java.util.Objects.requireNonNull(flexNodeHighlightConfigs, "flexNodeHighlightConfigs is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("flexNodeHighlightConfigs", flexNodeHighlightConfigs);
return new Command<>("Overlay.setShowFlexOverlays", Map.copyOf(params));
}
public static Command setShowScrollSnapOverlays(java.util.List scrollSnapHighlightConfigs) {
java.util.Objects.requireNonNull(scrollSnapHighlightConfigs, "scrollSnapHighlightConfigs is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("scrollSnapHighlightConfigs", scrollSnapHighlightConfigs);
return new Command<>("Overlay.setShowScrollSnapOverlays", Map.copyOf(params));
}
public static Command setShowContainerQueryOverlays(java.util.List containerQueryHighlightConfigs) {
java.util.Objects.requireNonNull(containerQueryHighlightConfigs, "containerQueryHighlightConfigs is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("containerQueryHighlightConfigs", containerQueryHighlightConfigs);
return new Command<>("Overlay.setShowContainerQueryOverlays", Map.copyOf(params));
}
/**
* Requests that backend shows paint rectangles
*/
public static Command setShowPaintRects(java.lang.Boolean result) {
java.util.Objects.requireNonNull(result, "result is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("result", result);
return new Command<>("Overlay.setShowPaintRects", Map.copyOf(params));
}
/**
* Requests that backend shows layout shift regions
*/
public static Command setShowLayoutShiftRegions(java.lang.Boolean result) {
java.util.Objects.requireNonNull(result, "result is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("result", result);
return new Command<>("Overlay.setShowLayoutShiftRegions", Map.copyOf(params));
}
/**
* Requests that backend shows scroll bottleneck rects
*/
public static Command setShowScrollBottleneckRects(java.lang.Boolean show) {
java.util.Objects.requireNonNull(show, "show is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("show", show);
return new Command<>("Overlay.setShowScrollBottleneckRects", Map.copyOf(params));
}
/**
* Deprecated, no longer has any effect.
*/
@Deprecated()
public static Command setShowHitTestBorders(java.lang.Boolean show) {
java.util.Objects.requireNonNull(show, "show is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("show", show);
return new Command<>("Overlay.setShowHitTestBorders", Map.copyOf(params));
}
/**
* Request that backend shows an overlay with web vital metrics.
*/
public static Command setShowWebVitals(java.lang.Boolean show) {
java.util.Objects.requireNonNull(show, "show is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("show", show);
return new Command<>("Overlay.setShowWebVitals", Map.copyOf(params));
}
/**
* Paints viewport size upon main frame resize.
*/
public static Command setShowViewportSizeOnResize(java.lang.Boolean show) {
java.util.Objects.requireNonNull(show, "show is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("show", show);
return new Command<>("Overlay.setShowViewportSizeOnResize", Map.copyOf(params));
}
/**
* Add a dual screen device hinge
*/
public static Command setShowHinge(java.util.Optional hingeConfig) {
LinkedHashMap params = new LinkedHashMap<>();
hingeConfig.ifPresent(p -> params.put("hingeConfig", p));
return new Command<>("Overlay.setShowHinge", Map.copyOf(params));
}
/**
* Show elements in isolation mode with overlays.
*/
public static Command setShowIsolatedElements(java.util.List isolatedElementHighlightConfigs) {
java.util.Objects.requireNonNull(isolatedElementHighlightConfigs, "isolatedElementHighlightConfigs is required");
LinkedHashMap params = new LinkedHashMap<>();
params.put("isolatedElementHighlightConfigs", isolatedElementHighlightConfigs);
return new Command<>("Overlay.setShowIsolatedElements", Map.copyOf(params));
}
/**
* Show Window Controls Overlay for PWA
*/
public static Command setShowWindowControlsOverlay(java.util.Optional windowControlsOverlayConfig) {
LinkedHashMap params = new LinkedHashMap<>();
windowControlsOverlayConfig.ifPresent(p -> params.put("windowControlsOverlayConfig", p));
return new Command<>("Overlay.setShowWindowControlsOverlay", Map.copyOf(params));
}
public static Event inspectNodeRequested() {
return new Event<>("Overlay.inspectNodeRequested", ConverterFunctions.map("backendNodeId", org.openqa.selenium.devtools.v122.dom.model.BackendNodeId.class));
}
public static Event nodeHighlightRequested() {
return new Event<>("Overlay.nodeHighlightRequested", ConverterFunctions.map("nodeId", org.openqa.selenium.devtools.v122.dom.model.NodeId.class));
}
public static Event screenshotRequested() {
return new Event<>("Overlay.screenshotRequested", ConverterFunctions.map("viewport", org.openqa.selenium.devtools.v122.page.model.Viewport.class));
}
public static Event inspectModeCanceled() {
return new Event<>("Overlay.inspectModeCanceled", ConverterFunctions.empty());
}
}