Package Torello.Browser.BrowserAPI
Class DOM
- java.lang.Object
-
- Torello.Browser.BrowserAPI.DOM
-
public class DOM extends java.lang.Object
This class was built using the Chrome Remote Dev-Tools A.P.I., which is specified by two JSON-RPC Files. These files were obtained from the Chrome Dev Tools Protocol Git Hub Page, which has a "Tip of Tree" (the latest) API-Specification Page Here: JSON-RPC Protocol Specification.
These files were converted into this Java-Browser (CDP) Library. The intention is to have them function in a similar fasion to the Node.js Tool known as 'Puppeteer', Microsoft's 'Playwright' and of course the Main-Stay 'Selenium.' The Java-HTML JAR Library merely implements the Java Types & Commands defined by Google's DevTools Protocol.
🧠 View the Google CDP API:
This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has anid. Thisidcan be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client. Note thatiframeowner elements will return corresponding document elements as their child nodes.
The top-level description and explanation for this class (this comment, at the top this Java-Doc Page) is repeated, verbatim, across all of the domain classes which comprise Google's CDP API.This class is intended to be used with a Browser Instance
These methods have been tested, to some degree, using Google Chrome. In order to use this class you must start a web-browser instance and make a connection to the browser using aRemote Debugging Port. Google-Corporation is the developer of this API, but any browser which accepts a Remote Debug Port Connection over Web-Sockets.
Google-Chrome was used during the development process of the classes in this particular package. Lately, it has been asserted Microsoft has switched to using the Chrome Browser-Engine for its Microsoft Edge Internal Code-Base. Therefore, there may some functionality available when running the methods in this class with Microsoft-Edge.
Check whether the your Web-Browser will allow itself to be driven by theWeb-Socket RDP-Port 9223. See the examples available in packageTorello.Browserto undertand how to build aPageConnandBrowserConnWeb-Socket Connection, and how to build aWebSocketSenderinstance in order to execute the methods in this class.
Web-Socket & JSON API:
Every one of the methods that reside in this class are designed to do nothing more than:- Accept Parameters from the User, and "Marshall Them" into a Valid JSON-Request
- Transmit the Marshalled Request-JSON to a Headless Web-Browser over a Web-Socket Connection
- Receive BOTH that Command-Results AND any Browser Event-Firings from the Web-Socket
- Parse JSON Method-Results and Browser-Event Firings, and Subsequently Convert them to Standard Java-Types
- Report these Method-Results and Browser-Events to the User via a User-Registered, Event-Listener (Events) or a Promise Object (Command Responses / Results)
Unlike the bulk of the Java HTML JAR Library, there is very little native Java-Code, and very little testing that may be done on any of the classes & methods in this package. The code inside these classes does nothing more than marshall-and-unmarshall Java-Types into Json-Requests (and vice-versa). The Java-Script & Browser modules inside of a Google-Chrome instance are, theoretically, handling these requests, and returning their results (or events) over the Web-Socket Connection.
It has been asserted (by Google Chrome Developers) that some of these methods are only "partially working" or "experimental".
Asking Chat-GPT for Help:
The LLM otherwise known as "Chat-GPT" does, indeed, have an expert level of knowledge about the "Remote DevTools Protocol". The API that theChrome DevTools Protocl (CDP)exports is extremely well understood by the LLM, and generally I have found that Chat-GPT understands (by 2 or 3 orders of magnitude) better what my Auto-Generated JSON-Wrappers can do in controlling a Web-Browser than I could ever possibly hope to understand.
Though not available today, there will soon be an automatically downloadable Token-Stream (AI Embeddings) BUTTON available on my Java-Doc Pages that should hopefully make it extremely easy to post my code-base, RAG Style, to Chat-GPT and other LLM's when 'interogating' them. Presently, because my "Get Token Stream Button" does not exist yet on any of my pages, what you can do is copy-and-paste any Method-Signature from any one of these pages and then ask Chat-GPT to explain what that Browser or Java-Script Function is actually doing. It is very likely to give you some pretty neat answers.
I have found that every single one of the Domains, Types & Events which are offered by the CDP Protocol (though not documented very well by Google), are perfectly understood by the A.I. LLM - literally to the point where it does know (much better than I ever could) what my own code base actually does!
Try it out, it's a lot of fun. Note that this package and these classes were originally developed solely to be able to execute the Java-Script that a browser executes when visiting a Web-Site. Complete HTML-Page Content can be scraped (using the HTML Data-Scraping Tools in Java-HTML) off of Web-Sites that have dynamic / Java-Script Generated Content.
Conspicuous Boxed-Types Usage:
You may notice that there are many methods that have parameters which accept, for instance, anInteger, instead of a primitiveint. Just to remind the readiner, in Java Programs aBoxed Typeis a standard Java-Primitive which has been converted into an Object-Reference. The use of Boxed-Types in this code base is an easy-and-fast-way to allow for the concept of "Optional Parameters" or "Optional Field Value."
Whenever you see a method that accepts anInteger, the reason for this Parameter-Type choice is actually to allow a user to pass 'null' to it. This is a simple way to ELIDE passing any value at all to parameters which Google-Chrome would otherwise assert are "Optional." Whenever you pass 'null' to a Boxed-Types in this class, the Json-Processor will simply eliminate that Object-Property from the command altogether; and the browser will simply not receive any value for that parameter when that command is invoked.
The Java Language Specification does not have an easy or well defined means of accepting optional method parameters; so Boxed-Types and 'null' are utilized here. Note that 'null' may be passed to any Command Method-Parameter that is listed asOptionalon the Java-Doc Page description for that parameter.
Hi-Lited Source-Code:This File's Source Code:
- View Here: Torello/Browser/BrowserAPI/DOM.java
- Open New Browser-Tab: Torello/Browser/BrowserAPI/DOM.java
File Size: 144,589 Bytes Line Count: 3,666 '\n' Characters Found
Helper: Command Invocation Helpers
- View Here: DOM$$Commands.java
- Open New Browser-Tab: DOM$$Commands.java
File Size: 21,014 Bytes Line Count: 491 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctionalAnnotation may also be called 'The Spaghetti Report'.Static-Functionalclasses are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@StatelessAnnotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 55 Method(s), 55 declared static
- 11 Field(s), 11 declared static, 11 declared final
-
-
Nested Class Summary
Type Nested Classes: Types / Classes that Are Used & Exported by this Domain Modifier and Type Class Description static classDOM.BackendNodeBackend node with a friendly name.static classDOM.BoxModelBox model.static classDOM.CSSComputedStyleProperty[No Description Provided by Google]static classDOM.DetachedElementInfoA structure to hold the top-level node of a detached tree and an array of its retained descendants.static classDOM.NodeDOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes.static classDOM.RectRectangle.static classDOM.RGBAA structure holding an RGBA color.static classDOM.ShapeOutsideInfoCSS Shape Outside details.Event Nested Classes: Browser Events, as Java Inner Classes, Which are Fired by this Domain Modifier and Type Class Description static classDOM.attributeModifiedFired whenElement's attribute is modified.static classDOM.attributeRemovedFired whenElement's attribute is removed.static classDOM.characterDataModifiedMirrorsDOMCharacterDataModifiedevent.static classDOM.childNodeCountUpdatedFired whenContainer's child node count has changed.static classDOM.childNodeInsertedMirrorsDOMNodeInsertedevent.static classDOM.childNodeRemovedMirrorsDOMNodeRemovedevent.static classDOM.distributedNodesUpdatedCalled when distribution is changed.static classDOM.inlineStyleInvalidatedFired whenElement's inline style is modified via a CSS property modification.static classDOM.pseudoElementAddedCalled when a pseudo element is added to an element.static classDOM.pseudoElementRemovedCalled when a pseudo element is removed from an element.static classDOM.scrollableFlagUpdatedFired when a node's scrollability state changes.static classDOM.setChildNodesFired when backend wants to provide client with the missing DOM structure.static classDOM.shadowRootPoppedCalled when shadow root is popped from the element.static classDOM.shadowRootPushedCalled when shadow root is pushed into the element.Command-Returns Nested Classes: Domain-Commands with Multiple Return-Values, and a Dedicated Inner-Class Modifier and Type Class Description static classDOM.getFrameOwner$$RETReturns iframe node that owns iframe with the given domain.static classDOM.getNodeForLocation$$RETReturns node id at given location.static classDOM.performSearch$$RETSearches for a given string in the DOM tree.
-
Field Summary
Enumerated Strings: Like Java 'enum' Types, but Converted to Read-Only String-Lists Modifier and Type Field Description static ReadOnlyList<String>CompatibilityModeDocument compatibility mode.static ReadOnlyList<String>LogicalAxesContainerSelector logical axesstatic ReadOnlyList<String>PhysicalAxesContainerSelector physical axesstatic ReadOnlyList<String>PseudoTypePseudo element type.static ReadOnlyList<String>ScrollOrientationPhysical scroll orientationstatic ReadOnlyList<String>ShadowRootTypeShadow root type.Eliminated Types: Removed CDP Types which Have Been Re-Mapped to Basic Java String Constants Modifier and Type Field Description static StringBackendNodeIdUnique DOM node identifier used to reference a node that may not have been pushed to the front-end.static StringNodeIdUnique DOM node identifier.static StringQuadAn array of quad vertices, x immediately followed by y for each point, points clock-wise.Marker Events: Events without any Fields or Properties Modifier and Type Field Description static StringdocumentUpdatedFired whenDocumenthas been totally updated.static StringtopLayerElementsUpdatedCalled when top layer elements are changed.
-
Method Summary
DOM Domain Commands Script Returns Modifier and Type Method String[]static Script<>collectClassNamesFromSubtree(int nodeId)
Collects class names for the node with given id and all of it's child nodes.Integerstatic Script<>copyTo(int nodeId, int targetNodeId, Integer insertBeforeNodeId)
Creates a deep copy of the specified node and places it into the target container before the given anchor.DOM.Nodestatic Script<>describeNode(Integer nodeId, Integer backendNodeId, String objectId, Integer depth, Boolean pierce)
Describes node given its id, does not require domain to be enabled.Voidstatic Script<>disable()
Disables DOM agent for the given page.Voidstatic Script<>discardSearchResults(String searchId)
Discards search results from the session with the given id.Voidstatic Script<>enable(String includeWhitespace)
Enables DOM agent for the given page.Voidstatic Script<>focus(Integer nodeId, Integer backendNodeId, String objectId)
Focuses the given element.int[]static Script<>forceShowPopover(int nodeId, boolean enable)
When enabling, this API force-opens the popover identified by nodeId and keeps it open until disabled.Integerstatic Script<>getAnchorElement(int nodeId, String anchorSpecifier)
Returns the target anchor element of the given anchor query according to https://www.w3.org/TR/css-anchor-position-1/#target.String[]static Script<>getAttributes(int nodeId)
Returns attributes for the specified node.DOM.BoxModelstatic Script<>getBoxModel(Integer nodeId, Integer backendNodeId, String objectId)
Returns boxes for the given node.Integerstatic Script<>getContainerForNode(int nodeId, String containerName, String physicalAxes, String logicalAxes, Boolean queriesScrollState, Boolean queriesAnchored)
Returns the query container of the given node based on container query conditions: containerName, physical and logical axes, and whether it queries scroll-state or anchored elements.Number[]static Script<>getContentQuads(Integer nodeId, Integer backendNodeId, String objectId)
Returns quads that describe node position on the page.DOM.DetachedElementInfo[]static Script<>getDetachedDomNodes()
Returns list of detached nodesDOM.Nodestatic Script<>getDocument(Integer depth, Boolean pierce)
Returns the root DOM node (and optionally the subtree) to the caller.Integerstatic Script<>getElementByRelation(int nodeId, String relation)
Returns the NodeId of the matched element according to certain relations.Stringstatic Script<>getFileInfo(String objectId)
Returns file information for the given File wrapper.DOM.Node[]static Script<>getFlattenedDocument(Integer depth, Boolean pierce)
Returns the root DOM node (and optionally the subtree) to the caller.DOM.getFrameOwner$$RETstatic Script<>getFrameOwner(String frameId)
Returns iframe node that owns iframe with the given domain.DOM.getNodeForLocation$$RETstatic Script<>getNodeForLocation(int x, int y, Boolean includeUserAgentShadowDOM, Boolean ignorePointerEventsNone)
Returns node id at given location.int[]static Script<>getNodesForSubtreeByStyle(int nodeId, DOM.CSSComputedStyleProperty[] computedStyles, Boolean pierce)
Finds nodes with a given computed style in a subtree.RunTime.StackTracestatic Script<>getNodeStackTraces(int nodeId)
Gets stack traces associated with a Node.Stringstatic Script<>getOuterHTML(Integer nodeId, Integer backendNodeId, String objectId, Boolean includeShadowDOM)
Returns node's HTML markup.int[]static Script<>getQueryingDescendantsForContainer(int nodeId)
Returns the descendants of a container query container that have container queries against this container.Integerstatic Script<>getRelayoutBoundary(int nodeId)
Returns the id of the nearest ancestor that is a relayout boundary.int[]static Script<>getSearchResults(String searchId, int fromIndex, int toIndex)
Returns search results from givenfromIndexto giventoIndexfrom the search with the given identifier.int[]static Script<>getTopLayerElements()
Returns NodeIds of current top layer elements.Voidstatic Script<>hideHighlight()
Hides any highlight.Voidstatic Script<>highlightNode()
Highlights DOM node.Voidstatic Script<>highlightRect()
Highlights given rectangle.Voidstatic Script<>markUndoableState()
Marks last undoable state.Integerstatic Script<>moveTo(int nodeId, int targetNodeId, Integer insertBeforeNodeId)
Moves node into the new container, places it before the given anchor.DOM.performSearch$$RETstatic Script<>performSearch(String query, Boolean includeUserAgentShadowDOM)
Searches for a given string in the DOM tree.Integerstatic Script<>pushNodeByPathToFrontend(String path)
Requests that the node is sent to the caller given its path.int[]static Script<>pushNodesByBackendIdsToFrontend(int[] backendNodeIds)
Requests that a batch of nodes is sent to the caller given their backend node ids.Integerstatic Script<>querySelector(int nodeId, String selector)
ExecutesquerySelectoron a given node.int[]static Script<>querySelectorAll(int nodeId, String selector)
ExecutesquerySelectorAllon a given node.Voidstatic Script<>redo()
Re-does the last undone action.Voidstatic Script<>removeAttribute(int nodeId, String name)
Removes attribute with given name from an element with given id.Voidstatic Script<>removeNode(int nodeId)
Removes node with given id.Voidstatic Script<>requestChildNodes(int nodeId, Integer depth, Boolean pierce)
Requests that children of the node with given id are returned to the caller in form ofsetChildNodesevents where not only immediate children are retrieved, but all children down to the specified depth.Integerstatic Script<>requestNode(String objectId)
Requests that the node is sent to the caller given the JavaScript node object reference.RunTime.RemoteObjectstatic Script<>resolveNode(Integer nodeId, Integer backendNodeId, String objectGroup, Integer executionContextId)
Resolves the JavaScript node object for a given NodeId or BackendNodeId.Voidstatic Script<>scrollIntoViewIfNeeded(Integer nodeId, Integer backendNodeId, String objectId, DOM.Rect rect)
Scrolls the specified rect of the given node into view if not already visible.Voidstatic Script<>setAttributesAsText(int nodeId, String text, String name)
Sets attributes on element with given id.Voidstatic Script<>setAttributeValue(int nodeId, String name, String value)
Sets attribute for an element with given id.Voidstatic Script<>setFileInputFiles(String[] files, Integer nodeId, Integer backendNodeId, String objectId)
Sets files for the given file input element.Voidstatic Script<>setInspectedNode(int nodeId)
Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).Integerstatic Script<>setNodeName(int nodeId, String name)
Sets node name for a node with given id.Voidstatic Script<>setNodeStackTracesEnabled(boolean enable)
Sets if stack traces should be captured for Nodes.Voidstatic Script<>setNodeValue(int nodeId, String value)
Sets node value for a node with given id.Voidstatic Script<>setOuterHTML(int nodeId, String outerHTML)
Sets node HTML markup, returns new node id.Voidstatic Script<>undo()
Undoes the last performed action.DOM Domain CommandBuilder Methods Modifier and Type Method Description static CommandBuilder
<DOM.Node>describeNode()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<Integer>getContainerForNode()Creates a buider for conveniently assigning parameters to this method.
-
-
-
Field Detail
-
BackendNodeId
public static final java.lang.String BackendNodeId
Unique DOM node identifier used to reference a node that may not have been pushed to the front-end.
The TypeBackendNodeIdhas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:int
Eliminated Type- See Also:
- Constant Field Values
-
NodeId
public static final java.lang.String NodeId
Unique DOM node identifier.
The TypeNodeIdhas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:int
Eliminated Type- See Also:
- Constant Field Values
-
Quad
public static final java.lang.String Quad
An array of quad vertices, x immediately followed by y for each point, points clock-wise.
The TypeQuadhas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:Number
Eliminated Type- See Also:
- Constant Field Values
-
documentUpdated
public static final java.lang.String documentUpdated
Fired whenDocumenthas been totally updated. Node ids are no longer valid.
This is Marker-Event. Marker-Event's are events that do not possess any data or fields at all. When such events are fired by the browser, the Web-Socket sends nothing more than the name of the event in the packet. The Java-HTML CDP Implementation (this library) has not actually created a dedicated Java Event-Type for this Browser Event.
This specificstaticfield is actually just declared aString.documentUpdatedhas not been 'reified' into an actual nested / inner class of its own, at all.
Eliminated Event Type- See Also:
- Constant Field Values
-
topLayerElementsUpdated
public static final java.lang.String topLayerElementsUpdated
Called when top layer elements are changed.
EXPERIMENTAL
This is Marker-Event. Marker-Event's are events that do not possess any data or fields at all. When such events are fired by the browser, the Web-Socket sends nothing more than the name of the event in the packet. The Java-HTML CDP Implementation (this library) has not actually created a dedicated Java Event-Type for this Browser Event.
This specificstaticfield is actually just declared aString.topLayerElementsUpdatedhas not been 'reified' into an actual nested / inner class of its own, at all.
Eliminated Event Type- See Also:
- Constant Field Values
-
CompatibilityMode
public static final ReadOnlyList<java.lang.String> CompatibilityMode
Document compatibility mode.
String-Enumeration Type
-
LogicalAxes
public static final ReadOnlyList<java.lang.String> LogicalAxes
ContainerSelector logical axes
String-Enumeration Type
-
PhysicalAxes
public static final ReadOnlyList<java.lang.String> PhysicalAxes
ContainerSelector physical axes
String-Enumeration Type
-
PseudoType
public static final ReadOnlyList<java.lang.String> PseudoType
Pseudo element type.
String-Enumeration Type
-
ScrollOrientation
public static final ReadOnlyList<java.lang.String> ScrollOrientation
Physical scroll orientation
String-Enumeration Type
-
ShadowRootType
public static final ReadOnlyList<java.lang.String> ShadowRootType
Shadow root type.
String-Enumeration Type
-
-
Method Detail
-
collectClassNamesFromSubtree
public static Script<java.lang.String[]> collectClassNamesFromSubtree (int nodeId)
Collects class names for the node with given id and all of it's child nodes.
EXPERIMENTAL- Parameters:
nodeId- Id of the node to collect class names.- Returns:
- An instance of
Script<String[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<String[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:String[] (classNames)
Class name list.
-
copyTo
public static Script<java.lang.Integer> copyTo (int nodeId, int targetNodeId, java.lang.Integer insertBeforeNodeId)
Creates a deep copy of the specified node and places it into the target container before the given anchor.
EXPERIMENTAL- Parameters:
nodeId- Id of the node to copy.targetNodeId- Id of the element to drop the copy into.insertBeforeNodeId- Drop the copy before this node (if absent, the copy becomes the last child oftargetNodeId).
OPTIONAL- Returns:
- An instance of
Script<Integer>
This script may be executed, usingScript.exec, and afterwards, aPromise<Integer>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Integer (nodeId)
Id of the node clone.
-
describeNode
public static Script<DOM.Node> describeNode (java.lang.Integer nodeId, java.lang.Integer backendNodeId, java.lang.String objectId, java.lang.Integer depth, java.lang.Boolean pierce)
Describes node given its id, does not require domain to be enabled. Does not start tracking any objects, can be used for automation.👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:describeNode()- Parameters:
nodeId- Identifier of the node.
OPTIONALbackendNodeId- Identifier of the backend node.
OPTIONALobjectId- JavaScript object id of the node wrapper.
OPTIONALdepth- The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
OPTIONALpierce- Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).
OPTIONAL- Returns:
- An instance of
Script<DOM.Node>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDOM.Node>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.
-
disable
-
discardSearchResults
public static Script<java.lang.Void> discardSearchResults (java.lang.String searchId)
Discards search results from the session with the given id.getSearchResultsshould no longer be called for that search.
EXPERIMENTAL- Parameters:
searchId- Unique search session identifier.- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
enable
public static Script<java.lang.Void> enable (java.lang.String includeWhitespace)
Enables DOM agent for the given page.- Parameters:
includeWhitespace- Whether to include whitespaces in the children array of returned Nodes.
Acceptable Values: ["all", "none"]
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
focus
public static Script<java.lang.Void> focus(java.lang.Integer nodeId, java.lang.Integer backendNodeId, java.lang.String objectId)
Focuses the given element.- Parameters:
nodeId- Identifier of the node.
OPTIONALbackendNodeId- Identifier of the backend node.
OPTIONALobjectId- JavaScript object id of the node wrapper.
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
forceShowPopover
public static Script<int[]> forceShowPopover(int nodeId, boolean enable)
When enabling, this API force-opens the popover identified by nodeId and keeps it open until disabled.
EXPERIMENTAL- Parameters:
nodeId- Id of the popover HTMLElementenable- If true, opens the popover and keeps it open. If false, closes the popover if it was previously force-opened.- Returns:
- An instance of
Script<int[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<int[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:int[] (nodeIds)
List of popovers that were closed in order to respect popover stacking order.
-
getAnchorElement
public static Script<java.lang.Integer> getAnchorElement (int nodeId, java.lang.String anchorSpecifier)
Returns the target anchor element of the given anchor query according to https://www.w3.org/TR/css-anchor-position-1/#target.
EXPERIMENTAL- Parameters:
nodeId- Id of the positioned element from which to find the anchor.anchorSpecifier- An optional anchor specifier, as defined in https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier. If not provided, it will return the implicit anchor element for the given positioned element.
OPTIONAL- Returns:
- An instance of
Script<Integer>
This script may be executed, usingScript.exec, and afterwards, aPromise<Integer>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Integer (nodeId)
The anchor element of the given anchor query.
-
getAttributes
public static Script<java.lang.String[]> getAttributes(int nodeId)
Returns attributes for the specified node.- Parameters:
nodeId- Id of the node to retrieve attributes for.- Returns:
- An instance of
Script<String[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<String[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:String[] (attributes)
An interleaved array of node attribute names and values.
-
getBoxModel
public static Script<DOM.BoxModel> getBoxModel (java.lang.Integer nodeId, java.lang.Integer backendNodeId, java.lang.String objectId)
Returns boxes for the given node.- Parameters:
nodeId- Identifier of the node.
OPTIONALbackendNodeId- Identifier of the backend node.
OPTIONALobjectId- JavaScript object id of the node wrapper.
OPTIONAL- Returns:
- An instance of
Script<DOM.BoxModel>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDOM.BoxModel>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.
-
getContainerForNode
public static Script<java.lang.Integer> getContainerForNode (int nodeId, java.lang.String containerName, java.lang.String physicalAxes, java.lang.String logicalAxes, java.lang.Boolean queriesScrollState, java.lang.Boolean queriesAnchored)
Returns the query container of the given node based on container query conditions: containerName, physical and logical axes, and whether it queries scroll-state or anchored elements. If no axes are provided and queriesScrollState is false, the style container is returned, which is the direct parent or the closest element with a matching container-name.
EXPERIMENTAL👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:getContainerForNode()- Parameters:
nodeId- -containerName- -
OPTIONALphysicalAxes- -
OPTIONALlogicalAxes- -
OPTIONALqueriesScrollState- -
OPTIONALqueriesAnchored- -
OPTIONAL- Returns:
- An instance of
Script<Integer>
This script may be executed, usingScript.exec, and afterwards, aPromise<Integer>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Integer (nodeId)
The container node for the given node, or null if not found.
-
getContentQuads
public static Script<java.lang.Number[]> getContentQuads (java.lang.Integer nodeId, java.lang.Integer backendNodeId, java.lang.String objectId)
Returns quads that describe node position on the page. This method might return multiple quads for inline nodes.
EXPERIMENTAL- Parameters:
nodeId- Identifier of the node.
OPTIONALbackendNodeId- Identifier of the backend node.
OPTIONALobjectId- JavaScript object id of the node wrapper.
OPTIONAL- Returns:
- An instance of
Script<Number[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<Number[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Number[] (quads)
Quads that describe node layout relative to viewport.
-
getDetachedDomNodes
public static Script<DOM.DetachedElementInfo[]> getDetachedDomNodes()
Returns list of detached nodes
EXPERIMENTAL- Returns:
- An instance of
Script<DOM.DetachedElementInfo[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDOM.DetachedElementInfo[]>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:DOM.DetachedElementInfo[] (detachedNodes)
The list of detached nodes
-
getDocument
public static Script<DOM.Node> getDocument(java.lang.Integer depth, java.lang.Boolean pierce)
Returns the root DOM node (and optionally the subtree) to the caller. Implicitly enables the DOM domain events for the current target.- Parameters:
depth- The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
OPTIONALpierce- Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).
OPTIONAL- Returns:
- An instance of
Script<DOM.Node>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDOM.Node>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.
-
getElementByRelation
public static Script<java.lang.Integer> getElementByRelation (int nodeId, java.lang.String relation)
Returns the NodeId of the matched element according to certain relations.
EXPERIMENTAL- Parameters:
nodeId- Id of the node from which to query the relation.relation- Type of relation to get.
Acceptable Values: ["CommandFor", "InterestTarget", "PopoverTarget"]- Returns:
- An instance of
Script<Integer>
This script may be executed, usingScript.exec, and afterwards, aPromise<Integer>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Integer (nodeId)
NodeId of the element matching the queried relation.
-
getFileInfo
public static Script<java.lang.String> getFileInfo (java.lang.String objectId)
Returns file information for the given File wrapper.
EXPERIMENTAL- Parameters:
objectId- JavaScript object id of the node wrapper.- Returns:
- An instance of
Script<String>
This script may be executed, usingScript.exec, and afterwards, aPromise<String>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:String (path)
-
getFlattenedDocument
public static Script<DOM.Node[]> getFlattenedDocument (java.lang.Integer depth, java.lang.Boolean pierce)
Returns the root DOM node (and optionally the subtree) to the caller. Deprecated, as it is not designed to work well with the rest of the DOM agent. Use DOMSnapshot.captureSnapshot instead.
DEPRECATED- Parameters:
depth- The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
OPTIONALpierce- Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).
OPTIONAL- Returns:
- An instance of
Script<DOM.Node[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDOM.Node[]>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.
-
getFrameOwner
public static Script<DOM.getFrameOwner$$RET> getFrameOwner (java.lang.String frameId)
Returns iframe node that owns iframe with the given domain.
EXPERIMENTAL- Parameters:
frameId- -- Returns:
- An instance of
Script<DOM.getFrameOwner$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDOM.getFrameOwner$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:DOM.getFrameOwner$$RETA dedicated return type implies that the browser may return more than 1 datum
-
getNodeForLocation
public static Script<DOM.getNodeForLocation$$RET> getNodeForLocation (int x, int y, java.lang.Boolean includeUserAgentShadowDOM, java.lang.Boolean ignorePointerEventsNone)
Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is either returned or not.- Parameters:
x- X coordinate.y- Y coordinate.includeUserAgentShadowDOM- False to skip to the nearest non-UA shadow root ancestor (default: false).
OPTIONALignorePointerEventsNone- Whether to ignore pointer-events: none on elements and hit test them.
OPTIONAL- Returns:
- An instance of
Script<DOM.getNodeForLocation$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDOM.getNodeForLocation$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:DOM.getNodeForLocation$$RETA dedicated return type implies that the browser may return more than 1 datum
-
getNodeStackTraces
public static Script<RunTime.StackTrace> getNodeStackTraces(int nodeId)
Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.
EXPERIMENTAL- Parameters:
nodeId- Id of the node to get stack traces for.- Returns:
- An instance of
Script<RunTime.StackTrace>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.StackTrace>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.StackTrace(creation)
Creation stack trace, if available.
-
getNodesForSubtreeByStyle
public static Script<int[]> getNodesForSubtreeByStyle (int nodeId, DOM.CSSComputedStyleProperty[] computedStyles, java.lang.Boolean pierce)
Finds nodes with a given computed style in a subtree.
EXPERIMENTAL- Parameters:
nodeId- Node ID pointing to the root of a subtree.computedStyles- The style to filter nodes by (includes nodes if any of properties matches).pierce- Whether or not iframes and shadow roots in the same target should be traversed when returning the results (default is false).
OPTIONAL- Returns:
- An instance of
Script<int[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<int[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:int[] (nodeIds)
Resulting nodes.
-
getOuterHTML
public static Script<java.lang.String> getOuterHTML (java.lang.Integer nodeId, java.lang.Integer backendNodeId, java.lang.String objectId, java.lang.Boolean includeShadowDOM)
Returns node's HTML markup.- Parameters:
nodeId- Identifier of the node.
OPTIONALbackendNodeId- Identifier of the backend node.
OPTIONALobjectId- JavaScript object id of the node wrapper.
OPTIONALincludeShadowDOM- Include all shadow roots. Equals to false if not specified.
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<String>
This script may be executed, usingScript.exec, and afterwards, aPromise<String>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:String (outerHTML)
Outer HTML markup.
-
getQueryingDescendantsForContainer
public static Script<int[]> getQueryingDescendantsForContainer(int nodeId)
Returns the descendants of a container query container that have container queries against this container.
EXPERIMENTAL- Parameters:
nodeId- Id of the container node to find querying descendants from.- Returns:
- An instance of
Script<int[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<int[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:int[] (nodeIds)
Descendant nodes with container queries against the given container.
-
getRelayoutBoundary
public static Script<java.lang.Integer> getRelayoutBoundary(int nodeId)
Returns the id of the nearest ancestor that is a relayout boundary.
EXPERIMENTAL- Parameters:
nodeId- Id of the node.- Returns:
- An instance of
Script<Integer>
This script may be executed, usingScript.exec, and afterwards, aPromise<Integer>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Integer (nodeId)
Relayout boundary node id for the given node.
-
getSearchResults
public static Script<int[]> getSearchResults(java.lang.String searchId, int fromIndex, int toIndex)
Returns search results from givenfromIndexto giventoIndexfrom the search with the given identifier.
EXPERIMENTAL- Parameters:
searchId- Unique search session identifier.fromIndex- Start index of the search result to be returned.toIndex- End index of the search result to be returned.- Returns:
- An instance of
Script<int[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<int[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:int[] (nodeIds)
Ids of the search result nodes.
-
getTopLayerElements
public static Script<int[]> getTopLayerElements()
Returns NodeIds of current top layer elements. Top layer is rendered closest to the user within a viewport, therefore its elements always appear on top of all other content.
EXPERIMENTAL- Returns:
- An instance of
Script<int[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<int[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:int[] (nodeIds)
NodeIds of top layer elements
-
hideHighlight
public static Script<java.lang.Void> hideHighlight()
Hides any highlight.
-
highlightNode
public static Script<java.lang.Void> highlightNode()
Highlights DOM node.
-
highlightRect
public static Script<java.lang.Void> highlightRect()
Highlights given rectangle.
-
markUndoableState
public static Script<java.lang.Void> markUndoableState()
Marks last undoable state.
EXPERIMENTAL
-
moveTo
public static Script<java.lang.Integer> moveTo (int nodeId, int targetNodeId, java.lang.Integer insertBeforeNodeId)
Moves node into the new container, places it before the given anchor.- Parameters:
nodeId- Id of the node to move.targetNodeId- Id of the element to drop the moved node into.insertBeforeNodeId- Drop node before this one (if absent, the moved node becomes the last child oftargetNodeId).
OPTIONAL- Returns:
- An instance of
Script<Integer>
This script may be executed, usingScript.exec, and afterwards, aPromise<Integer>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Integer (nodeId)
New id of the moved node.
-
performSearch
public static Script<DOM.performSearch$$RET> performSearch (java.lang.String query, java.lang.Boolean includeUserAgentShadowDOM)
Searches for a given string in the DOM tree. UsegetSearchResultsto access search results orcancelSearchto end this search session.
EXPERIMENTAL- Parameters:
query- Plain text or query selector or XPath search query.includeUserAgentShadowDOM- True to search in user agent shadow DOM.
OPTIONAL- Returns:
- An instance of
Script<DOM.performSearch$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDOM.performSearch$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:DOM.performSearch$$RETA dedicated return type implies that the browser may return more than 1 datum
-
pushNodeByPathToFrontend
public static Script<java.lang.Integer> pushNodeByPathToFrontend (java.lang.String path)
Requests that the node is sent to the caller given its path. // FIXME, use XPath
EXPERIMENTAL- Parameters:
path- Path to node in the proprietary format.- Returns:
- An instance of
Script<Integer>
This script may be executed, usingScript.exec, and afterwards, aPromise<Integer>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Integer (nodeId)
Id of the node for given path.
-
pushNodesByBackendIdsToFrontend
public static Script<int[]> pushNodesByBackendIdsToFrontend (int[] backendNodeIds)
Requests that a batch of nodes is sent to the caller given their backend node ids.
EXPERIMENTAL- Parameters:
backendNodeIds- The array of backend node ids.- Returns:
- An instance of
Script<int[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<int[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:int[] (nodeIds)
The array of ids of pushed nodes that correspond to the backend ids specified in backendNodeIds.
-
querySelector
public static Script<java.lang.Integer> querySelector (int nodeId, java.lang.String selector)
ExecutesquerySelectoron a given node.- Parameters:
nodeId- Id of the node to query upon.selector- Selector string.- Returns:
- An instance of
Script<Integer>
This script may be executed, usingScript.exec, and afterwards, aPromise<Integer>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Integer (nodeId)
Query selector result.
-
querySelectorAll
public static Script<int[]> querySelectorAll(int nodeId, java.lang.String selector)
ExecutesquerySelectorAllon a given node.- Parameters:
nodeId- Id of the node to query upon.selector- Selector string.- Returns:
- An instance of
Script<int[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<int[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:int[] (nodeIds)
Query selector result.
-
redo
-
removeAttribute
public static Script<java.lang.Void> removeAttribute(int nodeId, java.lang.String name)
Removes attribute with given name from an element with given id.- Parameters:
nodeId- Id of the element to remove attribute from.name- Name of the attribute to remove.- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
removeNode
public static Script<java.lang.Void> removeNode(int nodeId)
Removes node with given id.- Parameters:
nodeId- Id of the node to remove.- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
requestChildNodes
public static Script<java.lang.Void> requestChildNodes (int nodeId, java.lang.Integer depth, java.lang.Boolean pierce)
Requests that children of the node with given id are returned to the caller in form ofsetChildNodesevents where not only immediate children are retrieved, but all children down to the specified depth.- Parameters:
nodeId- Id of the node to get children for.depth- The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
OPTIONALpierce- Whether or not iframes and shadow roots should be traversed when returning the sub-tree (default is false).
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
requestNode
public static Script<java.lang.Integer> requestNode (java.lang.String objectId)
Requests that the node is sent to the caller given the JavaScript node object reference. All nodes that form the path from the node to the root are also sent to the client as a series ofsetChildNodesnotifications.- Parameters:
objectId- JavaScript object id to convert into node.- Returns:
- An instance of
Script<Integer>
This script may be executed, usingScript.exec, and afterwards, aPromise<Integer>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Integer (nodeId)
Node id for given object.
-
resolveNode
public static Script<RunTime.RemoteObject> resolveNode (java.lang.Integer nodeId, java.lang.Integer backendNodeId, java.lang.String objectGroup, java.lang.Integer executionContextId)
Resolves the JavaScript node object for a given NodeId or BackendNodeId.- Parameters:
nodeId- Id of the node to resolve.
OPTIONALbackendNodeId- Backend identifier of the node to resolve.
OPTIONALobjectGroup- Symbolic group name that can be used to release multiple objects.
OPTIONALexecutionContextId- Execution context in which to resolve the node.
OPTIONAL- Returns:
- An instance of
Script<RunTime.RemoteObject>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.RemoteObject>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.RemoteObject(object)
JavaScript object wrapper for given node.
-
scrollIntoViewIfNeeded
public static Script<java.lang.Void> scrollIntoViewIfNeeded (java.lang.Integer nodeId, java.lang.Integer backendNodeId, java.lang.String objectId, DOM.Rect rect)
Scrolls the specified rect of the given node into view if not already visible. Note: exactly one between nodeId, backendNodeId and objectId should be passed to identify the node.- Parameters:
nodeId- Identifier of the node.
OPTIONALbackendNodeId- Identifier of the backend node.
OPTIONALobjectId- JavaScript object id of the node wrapper.
OPTIONALrect- The rect to be scrolled into view, relative to the node's border box, in CSS pixels. When omitted, center of the node will be used, similar to Element.scrollIntoView.
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
setAttributeValue
public static Script<java.lang.Void> setAttributeValue (int nodeId, java.lang.String name, java.lang.String value)
Sets attribute for an element with given id.- Parameters:
nodeId- Id of the element to set attribute for.name- Attribute name.value- Attribute value.- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
setAttributesAsText
public static Script<java.lang.Void> setAttributesAsText (int nodeId, java.lang.String text, java.lang.String name)
Sets attributes on element with given id. This method is useful when user edits some existing attribute value and types in several attribute name/value pairs.- Parameters:
nodeId- Id of the element to set attributes for.text- Text with a number of attributes. Will parse this text using HTML parser.name- Attribute name to replace with new attributes derived from text in case text parsed successfully.
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
setFileInputFiles
public static Script<java.lang.Void> setFileInputFiles (java.lang.String[] files, java.lang.Integer nodeId, java.lang.Integer backendNodeId, java.lang.String objectId)
Sets files for the given file input element.- Parameters:
files- Array of file paths to set.nodeId- Identifier of the node.
OPTIONALbackendNodeId- Identifier of the backend node.
OPTIONALobjectId- JavaScript object id of the node wrapper.
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
setInspectedNode
public static Script<java.lang.Void> setInspectedNode(int nodeId)
Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
EXPERIMENTAL- Parameters:
nodeId- DOM node id to be accessible by means of $x command line API.- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
setNodeName
public static Script<java.lang.Integer> setNodeName(int nodeId, java.lang.String name)
Sets node name for a node with given id.- Parameters:
nodeId- Id of the node to set name for.name- New node's name.- Returns:
- An instance of
Script<Integer>
This script may be executed, usingScript.exec, and afterwards, aPromise<Integer>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Integer (nodeId)
New node's id.
-
setNodeStackTracesEnabled
public static Script<java.lang.Void> setNodeStackTracesEnabled (boolean enable)
Sets if stack traces should be captured for Nodes. SeeNode.getNodeStackTraces. Default is disabled.
EXPERIMENTAL- Parameters:
enable- Enable or disable.- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
setNodeValue
public static Script<java.lang.Void> setNodeValue(int nodeId, java.lang.String value)
Sets node value for a node with given id.- Parameters:
nodeId- Id of the node to set value for.value- New node's value.- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
setOuterHTML
public static Script<java.lang.Void> setOuterHTML (int nodeId, java.lang.String outerHTML)
Sets node HTML markup, returns new node id.- Parameters:
nodeId- Id of the node to set markup for.outerHTML- Outer HTML markup to set.- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
undo
-
describeNode
public static CommandBuilder<DOM.Node> describeNode()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 5 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
describeNode(java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.Integer, java.lang.Boolean)
-
getContainerForNode
public static CommandBuilder<java.lang.Integer> getContainerForNode()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 6 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
getContainerForNode(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean)
-
-