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

org.openqa.selenium.devtools.v88.domsnapshot.model.DOMNode Maven / Gradle / Ivy

package org.openqa.selenium.devtools.v88.domsnapshot.model;

import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;

/**
 * A Node in the DOM tree.
 */
public class DOMNode {

    private final java.lang.Integer nodeType;

    private final java.lang.String nodeName;

    private final java.lang.String nodeValue;

    private final java.util.Optional textValue;

    private final java.util.Optional inputValue;

    private final java.util.Optional inputChecked;

    private final java.util.Optional optionSelected;

    private final org.openqa.selenium.devtools.v88.dom.model.BackendNodeId backendNodeId;

    private final java.util.Optional> childNodeIndexes;

    private final java.util.Optional> attributes;

    private final java.util.Optional> pseudoElementIndexes;

    private final java.util.Optional layoutNodeIndex;

    private final java.util.Optional documentURL;

    private final java.util.Optional baseURL;

    private final java.util.Optional contentLanguage;

    private final java.util.Optional documentEncoding;

    private final java.util.Optional publicId;

    private final java.util.Optional systemId;

    private final java.util.Optional frameId;

    private final java.util.Optional contentDocumentIndex;

    private final java.util.Optional pseudoType;

    private final java.util.Optional shadowRootType;

    private final java.util.Optional isClickable;

    private final java.util.Optional> eventListeners;

    private final java.util.Optional currentSourceURL;

    private final java.util.Optional originURL;

    private final java.util.Optional scrollOffsetX;

    private final java.util.Optional scrollOffsetY;

    public DOMNode(java.lang.Integer nodeType, java.lang.String nodeName, java.lang.String nodeValue, java.util.Optional textValue, java.util.Optional inputValue, java.util.Optional inputChecked, java.util.Optional optionSelected, org.openqa.selenium.devtools.v88.dom.model.BackendNodeId backendNodeId, java.util.Optional> childNodeIndexes, java.util.Optional> attributes, java.util.Optional> pseudoElementIndexes, java.util.Optional layoutNodeIndex, java.util.Optional documentURL, java.util.Optional baseURL, java.util.Optional contentLanguage, java.util.Optional documentEncoding, java.util.Optional publicId, java.util.Optional systemId, java.util.Optional frameId, java.util.Optional contentDocumentIndex, java.util.Optional pseudoType, java.util.Optional shadowRootType, java.util.Optional isClickable, java.util.Optional> eventListeners, java.util.Optional currentSourceURL, java.util.Optional originURL, java.util.Optional scrollOffsetX, java.util.Optional scrollOffsetY) {
        this.nodeType = java.util.Objects.requireNonNull(nodeType, "nodeType is required");
        this.nodeName = java.util.Objects.requireNonNull(nodeName, "nodeName is required");
        this.nodeValue = java.util.Objects.requireNonNull(nodeValue, "nodeValue is required");
        this.textValue = textValue;
        this.inputValue = inputValue;
        this.inputChecked = inputChecked;
        this.optionSelected = optionSelected;
        this.backendNodeId = java.util.Objects.requireNonNull(backendNodeId, "backendNodeId is required");
        this.childNodeIndexes = childNodeIndexes;
        this.attributes = attributes;
        this.pseudoElementIndexes = pseudoElementIndexes;
        this.layoutNodeIndex = layoutNodeIndex;
        this.documentURL = documentURL;
        this.baseURL = baseURL;
        this.contentLanguage = contentLanguage;
        this.documentEncoding = documentEncoding;
        this.publicId = publicId;
        this.systemId = systemId;
        this.frameId = frameId;
        this.contentDocumentIndex = contentDocumentIndex;
        this.pseudoType = pseudoType;
        this.shadowRootType = shadowRootType;
        this.isClickable = isClickable;
        this.eventListeners = eventListeners;
        this.currentSourceURL = currentSourceURL;
        this.originURL = originURL;
        this.scrollOffsetX = scrollOffsetX;
        this.scrollOffsetY = scrollOffsetY;
    }

    /**
     * `Node`'s nodeType.
     */
    public java.lang.Integer getNodeType() {
        return nodeType;
    }

    /**
     * `Node`'s nodeName.
     */
    public java.lang.String getNodeName() {
        return nodeName;
    }

    /**
     * `Node`'s nodeValue.
     */
    public java.lang.String getNodeValue() {
        return nodeValue;
    }

    /**
     * Only set for textarea elements, contains the text value.
     */
    public java.util.Optional getTextValue() {
        return textValue;
    }

    /**
     * Only set for input elements, contains the input's associated text value.
     */
    public java.util.Optional getInputValue() {
        return inputValue;
    }

    /**
     * Only set for radio and checkbox input elements, indicates if the element has been checked
     */
    public java.util.Optional getInputChecked() {
        return inputChecked;
    }

    /**
     * Only set for option elements, indicates if the element has been selected
     */
    public java.util.Optional getOptionSelected() {
        return optionSelected;
    }

    /**
     * `Node`'s id, corresponds to DOM.Node.backendNodeId.
     */
    public org.openqa.selenium.devtools.v88.dom.model.BackendNodeId getBackendNodeId() {
        return backendNodeId;
    }

    /**
     * The indexes of the node's child nodes in the `domNodes` array returned by `getSnapshot`, if
     * any.
     */
    public java.util.Optional> getChildNodeIndexes() {
        return childNodeIndexes;
    }

    /**
     * Attributes of an `Element` node.
     */
    public java.util.Optional> getAttributes() {
        return attributes;
    }

    /**
     * Indexes of pseudo elements associated with this node in the `domNodes` array returned by
     * `getSnapshot`, if any.
     */
    public java.util.Optional> getPseudoElementIndexes() {
        return pseudoElementIndexes;
    }

    /**
     * The index of the node's related layout tree node in the `layoutTreeNodes` array returned by
     * `getSnapshot`, if any.
     */
    public java.util.Optional getLayoutNodeIndex() {
        return layoutNodeIndex;
    }

    /**
     * Document URL that `Document` or `FrameOwner` node points to.
     */
    public java.util.Optional getDocumentURL() {
        return documentURL;
    }

    /**
     * Base URL that `Document` or `FrameOwner` node uses for URL completion.
     */
    public java.util.Optional getBaseURL() {
        return baseURL;
    }

    /**
     * Only set for documents, contains the document's content language.
     */
    public java.util.Optional getContentLanguage() {
        return contentLanguage;
    }

    /**
     * Only set for documents, contains the document's character set encoding.
     */
    public java.util.Optional getDocumentEncoding() {
        return documentEncoding;
    }

    /**
     * `DocumentType` node's publicId.
     */
    public java.util.Optional getPublicId() {
        return publicId;
    }

    /**
     * `DocumentType` node's systemId.
     */
    public java.util.Optional getSystemId() {
        return systemId;
    }

    /**
     * Frame ID for frame owner elements and also for the document node.
     */
    public java.util.Optional getFrameId() {
        return frameId;
    }

    /**
     * The index of a frame owner element's content document in the `domNodes` array returned by
     * `getSnapshot`, if any.
     */
    public java.util.Optional getContentDocumentIndex() {
        return contentDocumentIndex;
    }

    /**
     * Type of a pseudo element node.
     */
    public java.util.Optional getPseudoType() {
        return pseudoType;
    }

    /**
     * Shadow root type.
     */
    public java.util.Optional getShadowRootType() {
        return shadowRootType;
    }

    /**
     * Whether this DOM node responds to mouse clicks. This includes nodes that have had click
     * event listeners attached via JavaScript as well as anchor tags that naturally navigate when
     * clicked.
     */
    public java.util.Optional getIsClickable() {
        return isClickable;
    }

    /**
     * Details of the node's event listeners, if any.
     */
    public java.util.Optional> getEventListeners() {
        return eventListeners;
    }

    /**
     * The selected url for nodes with a srcset attribute.
     */
    public java.util.Optional getCurrentSourceURL() {
        return currentSourceURL;
    }

    /**
     * The url of the script (if any) that generates this node.
     */
    public java.util.Optional getOriginURL() {
        return originURL;
    }

    /**
     * Scroll offsets, set when this node is a Document.
     */
    public java.util.Optional getScrollOffsetX() {
        return scrollOffsetX;
    }

    public java.util.Optional getScrollOffsetY() {
        return scrollOffsetY;
    }

    private static DOMNode fromJson(JsonInput input) {
        java.lang.Integer nodeType = 0;
        java.lang.String nodeName = null;
        java.lang.String nodeValue = null;
        java.util.Optional textValue = java.util.Optional.empty();
        java.util.Optional inputValue = java.util.Optional.empty();
        java.util.Optional inputChecked = java.util.Optional.empty();
        java.util.Optional optionSelected = java.util.Optional.empty();
        org.openqa.selenium.devtools.v88.dom.model.BackendNodeId backendNodeId = null;
        java.util.Optional> childNodeIndexes = java.util.Optional.empty();
        java.util.Optional> attributes = java.util.Optional.empty();
        java.util.Optional> pseudoElementIndexes = java.util.Optional.empty();
        java.util.Optional layoutNodeIndex = java.util.Optional.empty();
        java.util.Optional documentURL = java.util.Optional.empty();
        java.util.Optional baseURL = java.util.Optional.empty();
        java.util.Optional contentLanguage = java.util.Optional.empty();
        java.util.Optional documentEncoding = java.util.Optional.empty();
        java.util.Optional publicId = java.util.Optional.empty();
        java.util.Optional systemId = java.util.Optional.empty();
        java.util.Optional frameId = java.util.Optional.empty();
        java.util.Optional contentDocumentIndex = java.util.Optional.empty();
        java.util.Optional pseudoType = java.util.Optional.empty();
        java.util.Optional shadowRootType = java.util.Optional.empty();
        java.util.Optional isClickable = java.util.Optional.empty();
        java.util.Optional> eventListeners = java.util.Optional.empty();
        java.util.Optional currentSourceURL = java.util.Optional.empty();
        java.util.Optional originURL = java.util.Optional.empty();
        java.util.Optional scrollOffsetX = java.util.Optional.empty();
        java.util.Optional scrollOffsetY = java.util.Optional.empty();
        input.beginObject();
        while (input.hasNext()) {
            switch(input.nextName()) {
                case "nodeType":
                    nodeType = input.nextNumber().intValue();
                    break;
                case "nodeName":
                    nodeName = input.nextString();
                    break;
                case "nodeValue":
                    nodeValue = input.nextString();
                    break;
                case "textValue":
                    textValue = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "inputValue":
                    inputValue = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "inputChecked":
                    inputChecked = java.util.Optional.ofNullable(input.nextBoolean());
                    break;
                case "optionSelected":
                    optionSelected = java.util.Optional.ofNullable(input.nextBoolean());
                    break;
                case "backendNodeId":
                    backendNodeId = input.read(org.openqa.selenium.devtools.v88.dom.model.BackendNodeId.class);
                    break;
                case "childNodeIndexes":
                    childNodeIndexes = java.util.Optional.ofNullable(input.read(new com.google.common.reflect.TypeToken>() {
                    }.getType()));
                    break;
                case "attributes":
                    attributes = java.util.Optional.ofNullable(input.read(new com.google.common.reflect.TypeToken>() {
                    }.getType()));
                    break;
                case "pseudoElementIndexes":
                    pseudoElementIndexes = java.util.Optional.ofNullable(input.read(new com.google.common.reflect.TypeToken>() {
                    }.getType()));
                    break;
                case "layoutNodeIndex":
                    layoutNodeIndex = java.util.Optional.ofNullable(input.nextNumber().intValue());
                    break;
                case "documentURL":
                    documentURL = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "baseURL":
                    baseURL = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "contentLanguage":
                    contentLanguage = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "documentEncoding":
                    documentEncoding = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "publicId":
                    publicId = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "systemId":
                    systemId = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "frameId":
                    frameId = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v88.page.model.FrameId.class));
                    break;
                case "contentDocumentIndex":
                    contentDocumentIndex = java.util.Optional.ofNullable(input.nextNumber().intValue());
                    break;
                case "pseudoType":
                    pseudoType = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v88.dom.model.PseudoType.class));
                    break;
                case "shadowRootType":
                    shadowRootType = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v88.dom.model.ShadowRootType.class));
                    break;
                case "isClickable":
                    isClickable = java.util.Optional.ofNullable(input.nextBoolean());
                    break;
                case "eventListeners":
                    eventListeners = java.util.Optional.ofNullable(input.read(new com.google.common.reflect.TypeToken>() {
                    }.getType()));
                    break;
                case "currentSourceURL":
                    currentSourceURL = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "originURL":
                    originURL = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "scrollOffsetX":
                    scrollOffsetX = java.util.Optional.ofNullable(input.nextNumber());
                    break;
                case "scrollOffsetY":
                    scrollOffsetY = java.util.Optional.ofNullable(input.nextNumber());
                    break;
                default:
                    input.skipValue();
                    break;
            }
        }
        input.endObject();
        return new DOMNode(nodeType, nodeName, nodeValue, textValue, inputValue, inputChecked, optionSelected, backendNodeId, childNodeIndexes, attributes, pseudoElementIndexes, layoutNodeIndex, documentURL, baseURL, contentLanguage, documentEncoding, publicId, systemId, frameId, contentDocumentIndex, pseudoType, shadowRootType, isClickable, eventListeners, currentSourceURL, originURL, scrollOffsetX, scrollOffsetY);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy