org.openqa.selenium.devtools.v90.domsnapshot.model.LayoutTreeSnapshot Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-devtools-v90 Show documentation
Show all versions of selenium-devtools-v90 Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
package org.openqa.selenium.devtools.v90.domsnapshot.model;
import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;
/**
* Table of details of an element in the DOM tree with a LayoutObject.
*/
public class LayoutTreeSnapshot {
private final java.util.List nodeIndex;
private final java.util.List styles;
private final java.util.List bounds;
private final java.util.List text;
private final org.openqa.selenium.devtools.v90.domsnapshot.model.RareBooleanData stackingContexts;
private final java.util.Optional> paintOrders;
private final java.util.Optional> offsetRects;
private final java.util.Optional> scrollRects;
private final java.util.Optional> clientRects;
public LayoutTreeSnapshot(java.util.List nodeIndex, java.util.List styles, java.util.List bounds, java.util.List text, org.openqa.selenium.devtools.v90.domsnapshot.model.RareBooleanData stackingContexts, java.util.Optional> paintOrders, java.util.Optional> offsetRects, java.util.Optional> scrollRects, java.util.Optional> clientRects) {
this.nodeIndex = java.util.Objects.requireNonNull(nodeIndex, "nodeIndex is required");
this.styles = java.util.Objects.requireNonNull(styles, "styles is required");
this.bounds = java.util.Objects.requireNonNull(bounds, "bounds is required");
this.text = java.util.Objects.requireNonNull(text, "text is required");
this.stackingContexts = java.util.Objects.requireNonNull(stackingContexts, "stackingContexts is required");
this.paintOrders = paintOrders;
this.offsetRects = offsetRects;
this.scrollRects = scrollRects;
this.clientRects = clientRects;
}
/**
* Index of the corresponding node in the `NodeTreeSnapshot` array returned by `captureSnapshot`.
*/
public java.util.List getNodeIndex() {
return nodeIndex;
}
/**
* Array of indexes specifying computed style strings, filtered according to the `computedStyles` parameter passed to `captureSnapshot`.
*/
public java.util.List getStyles() {
return styles;
}
/**
* The absolute position bounding box.
*/
public java.util.List getBounds() {
return bounds;
}
/**
* Contents of the LayoutText, if any.
*/
public java.util.List getText() {
return text;
}
/**
* Stacking context information.
*/
public org.openqa.selenium.devtools.v90.domsnapshot.model.RareBooleanData getStackingContexts() {
return stackingContexts;
}
/**
* Global paint order index, which is determined by the stacking order of the nodes. Nodes
* that are painted together will have the same index. Only provided if includePaintOrder in
* captureSnapshot was true.
*/
public java.util.Optional> getPaintOrders() {
return paintOrders;
}
/**
* The offset rect of nodes. Only available when includeDOMRects is set to true
*/
public java.util.Optional> getOffsetRects() {
return offsetRects;
}
/**
* The scroll rect of nodes. Only available when includeDOMRects is set to true
*/
public java.util.Optional> getScrollRects() {
return scrollRects;
}
/**
* The client rect of nodes. Only available when includeDOMRects is set to true
*/
public java.util.Optional> getClientRects() {
return clientRects;
}
private static LayoutTreeSnapshot fromJson(JsonInput input) {
java.util.List nodeIndex = null;
java.util.List styles = null;
java.util.List bounds = null;
java.util.List text = null;
org.openqa.selenium.devtools.v90.domsnapshot.model.RareBooleanData stackingContexts = null;
java.util.Optional> paintOrders = java.util.Optional.empty();
java.util.Optional> offsetRects = java.util.Optional.empty();
java.util.Optional> scrollRects = java.util.Optional.empty();
java.util.Optional> clientRects = java.util.Optional.empty();
input.beginObject();
while (input.hasNext()) {
switch(input.nextName()) {
case "nodeIndex":
nodeIndex = input.read(new com.google.common.reflect.TypeToken>() {
}.getType());
break;
case "styles":
styles = input.read(new com.google.common.reflect.TypeToken>() {
}.getType());
break;
case "bounds":
bounds = input.read(new com.google.common.reflect.TypeToken>() {
}.getType());
break;
case "text":
text = input.read(new com.google.common.reflect.TypeToken>() {
}.getType());
break;
case "stackingContexts":
stackingContexts = input.read(org.openqa.selenium.devtools.v90.domsnapshot.model.RareBooleanData.class);
break;
case "paintOrders":
paintOrders = java.util.Optional.ofNullable(input.read(new com.google.common.reflect.TypeToken>() {
}.getType()));
break;
case "offsetRects":
offsetRects = java.util.Optional.ofNullable(input.read(new com.google.common.reflect.TypeToken>() {
}.getType()));
break;
case "scrollRects":
scrollRects = java.util.Optional.ofNullable(input.read(new com.google.common.reflect.TypeToken>() {
}.getType()));
break;
case "clientRects":
clientRects = java.util.Optional.ofNullable(input.read(new com.google.common.reflect.TypeToken>() {
}.getType()));
break;
default:
input.skipValue();
break;
}
}
input.endObject();
return new LayoutTreeSnapshot(nodeIndex, styles, bounds, text, stackingContexts, paintOrders, offsetRects, scrollRects, clientRects);
}
}