clj-chrome-devtools.commands.dom

This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an id. This id can 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 that iframe owner elements will return corresponding document elements as their child nodes.

collect-class-names-from-subtree

(collect-class-names-from-subtree)(collect-class-names-from-subtree {:as params, :keys [node-id]})(collect-class-names-from-subtree connection {:as params, :keys [node-id]})

Collects class names for the node with given id and all of it’s child nodes.

Parameters map keys:

Key Description
:node-id Id of the node to collect class names.

Return map keys:

Key Description
:class-names Class name list.

copy-to

(copy-to)(copy-to {:as params, :keys [node-id target-node-id insert-before-node-id]})(copy-to connection {:as params, :keys [node-id target-node-id insert-before-node-id]})

Creates a deep copy of the specified node and places it into the target container before the given anchor.

Parameters map keys:

Key Description
:node-id Id of the node to copy.
:target-node-id Id of the element to drop the copy into.
:insert-before-node-id Drop the copy before this node (if absent, the copy becomes the last child of

targetNodeId). (optional)

Return map keys:

Key Description
:node-id Id of the node clone.

describe-node

(describe-node)(describe-node {:as params, :keys [node-id backend-node-id object-id depth pierce]})(describe-node connection {:as params, :keys [node-id backend-node-id object-id depth pierce]})

Describes node given its id, does not require domain to be enabled. Does not start tracking any objects, can be used for automation.

Parameters map keys:

Key Description
:node-id Identifier of the node. (optional)
:backend-node-id Identifier of the backend node. (optional)
:object-id JavaScript object id of the node wrapper. (optional)
: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. (optional) :pierce | Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). (optional)

Return map keys:

Key Description
:node Node description.

disable

(disable)(disable {:as params, :keys []})(disable connection {:as params, :keys []})

Disables DOM agent for the given page.

discard-search-results

(discard-search-results)(discard-search-results {:as params, :keys [search-id]})(discard-search-results connection {:as params, :keys [search-id]})

Discards search results from the session with the given id. getSearchResults should no longer be called for that search.

Parameters map keys:

Key Description
:search-id Unique search session identifier.

enable

(enable)(enable {:as params, :keys [include-whitespace]})(enable connection {:as params, :keys [include-whitespace]})

Enables DOM agent for the given page.

Parameters map keys:

Key Description
:include-whitespace Whether to include whitespaces in the children array of returned Nodes. (optional)

focus

(focus)(focus {:as params, :keys [node-id backend-node-id object-id]})(focus connection {:as params, :keys [node-id backend-node-id object-id]})

Focuses the given element.

Parameters map keys:

Key Description
:node-id Identifier of the node. (optional)
:backend-node-id Identifier of the backend node. (optional)
:object-id JavaScript object id of the node wrapper. (optional)

get-attributes

(get-attributes)(get-attributes {:as params, :keys [node-id]})(get-attributes connection {:as params, :keys [node-id]})

Returns attributes for the specified node.

Parameters map keys:

Key Description
:node-id Id of the node to retrieve attibutes for.

Return map keys:

Key Description
:attributes An interleaved array of node attribute names and values.

get-box-model

(get-box-model)(get-box-model {:as params, :keys [node-id backend-node-id object-id]})(get-box-model connection {:as params, :keys [node-id backend-node-id object-id]})

Returns boxes for the given node.

Parameters map keys:

Key Description
:node-id Identifier of the node. (optional)
:backend-node-id Identifier of the backend node. (optional)
:object-id JavaScript object id of the node wrapper. (optional)

Return map keys:

Key Description
:model Box model for the node.

get-container-for-node

(get-container-for-node)(get-container-for-node {:as params, :keys [node-id container-name]})(get-container-for-node connection {:as params, :keys [node-id container-name]})

Returns the container of the given node based on container query conditions. If containerName is given, it will find the nearest container with a matching name; otherwise it will find the nearest container regardless of its container name.

Parameters map keys:

Key Description
:node-id null
:container-name null (optional)

Return map keys:

Key Description
:node-id The container node for the given node, or null if not found. (optional)

get-content-quads

(get-content-quads)(get-content-quads {:as params, :keys [node-id backend-node-id object-id]})(get-content-quads connection {:as params, :keys [node-id backend-node-id object-id]})

Returns quads that describe node position on the page. This method might return multiple quads for inline nodes.

Parameters map keys:

Key Description
:node-id Identifier of the node. (optional)
:backend-node-id Identifier of the backend node. (optional)
:object-id JavaScript object id of the node wrapper. (optional)

Return map keys:

Key Description
:quads Quads that describe node layout relative to viewport.

get-document

(get-document)(get-document {:as params, :keys [depth pierce]})(get-document connection {:as params, :keys [depth pierce]})

Returns the root DOM node (and optionally the subtree) to the caller.

Parameters map keys:

Key Description
: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. (optional) :pierce | Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). (optional)

Return map keys:

Key Description
:root Resulting node.

get-file-info

(get-file-info)(get-file-info {:as params, :keys [object-id]})(get-file-info connection {:as params, :keys [object-id]})

Returns file information for the given File wrapper.

Parameters map keys:

Key Description
:object-id JavaScript object id of the node wrapper.

Return map keys:

Key Description
:path null

get-flattened-document

(get-flattened-document)(get-flattened-document {:as params, :keys [depth pierce]})(get-flattened-document connection {:as params, :keys [depth 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.

Parameters map keys:

Key Description
: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. (optional) :pierce | Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). (optional)

Return map keys:

Key Description
:nodes Resulting node.

get-frame-owner

(get-frame-owner)(get-frame-owner {:as params, :keys [frame-id]})(get-frame-owner connection {:as params, :keys [frame-id]})

Returns iframe node that owns iframe with the given domain.

Parameters map keys:

Key Description
:frame-id null

Return map keys:

Key Description
:backend-node-id Resulting node.
:node-id Id of the node at given coordinates, only when enabled and requested document. (optional)

get-node-for-location

(get-node-for-location)(get-node-for-location {:as params, :keys [x y include-user-agent-shadow-dom ignore-pointer-events-none]})(get-node-for-location connection {:as params, :keys [x y include-user-agent-shadow-dom ignore-pointer-events-none]})

Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is either returned or not.

Parameters map keys:

Key Description
:x X coordinate.
:y Y coordinate.
:include-user-agent-shadow-dom False to skip to the nearest non-UA shadow root ancestor (default: false). (optional)
:ignore-pointer-events-none Whether to ignore pointer-events: none on elements and hit test them. (optional)

Return map keys:

Key Description
:backend-node-id Resulting node.
:frame-id Frame this node belongs to.
:node-id Id of the node at given coordinates, only when enabled and requested document. (optional)

get-node-stack-traces

(get-node-stack-traces)(get-node-stack-traces {:as params, :keys [node-id]})(get-node-stack-traces connection {:as params, :keys [node-id]})

Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.

Parameters map keys:

Key Description
:node-id Id of the node to get stack traces for.

Return map keys:

Key Description
:creation Creation stack trace, if available. (optional)

get-nodes-for-subtree-by-style

(get-nodes-for-subtree-by-style)(get-nodes-for-subtree-by-style {:as params, :keys [node-id computed-styles pierce]})(get-nodes-for-subtree-by-style connection {:as params, :keys [node-id computed-styles pierce]})

Finds nodes with a given computed style in a subtree.

Parameters map keys:

Key Description
:node-id Node ID pointing to the root of a subtree.
:computed-styles 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)

Return map keys:

Key Description
:node-ids Resulting nodes.

get-outer-html

(get-outer-html)(get-outer-html {:as params, :keys [node-id backend-node-id object-id]})(get-outer-html connection {:as params, :keys [node-id backend-node-id object-id]})

Returns node’s HTML markup.

Parameters map keys:

Key Description
:node-id Identifier of the node. (optional)
:backend-node-id Identifier of the backend node. (optional)
:object-id JavaScript object id of the node wrapper. (optional)

Return map keys:

Key Description
:outer-html Outer HTML markup.

get-querying-descendants-for-container

(get-querying-descendants-for-container)(get-querying-descendants-for-container {:as params, :keys [node-id]})(get-querying-descendants-for-container connection {:as params, :keys [node-id]})

Returns the descendants of a container query container that have container queries against this container.

Parameters map keys:

Key Description
:node-id Id of the container node to find querying descendants from.

Return map keys:

Key Description
:node-ids Descendant nodes with container queries against the given container.

get-relayout-boundary

(get-relayout-boundary)(get-relayout-boundary {:as params, :keys [node-id]})(get-relayout-boundary connection {:as params, :keys [node-id]})

Returns the id of the nearest ancestor that is a relayout boundary.

Parameters map keys:

Key Description
:node-id Id of the node.

Return map keys:

Key Description
:node-id Relayout boundary node id for the given node.

get-search-results

(get-search-results)(get-search-results {:as params, :keys [search-id from-index to-index]})(get-search-results connection {:as params, :keys [search-id from-index to-index]})

Returns search results from given fromIndex to given toIndex from the search with the given identifier.

Parameters map keys:

Key Description
:search-id Unique search session identifier.
:from-index Start index of the search result to be returned.
:to-index End index of the search result to be returned.

Return map keys:

Key Description
:node-ids Ids of the search result nodes.

hide-highlight

(hide-highlight)(hide-highlight {:as params, :keys []})(hide-highlight connection {:as params, :keys []})

Hides any highlight.

highlight-node

(highlight-node)(highlight-node {:as params, :keys []})(highlight-node connection {:as params, :keys []})

Highlights DOM node.

highlight-rect

(highlight-rect)(highlight-rect {:as params, :keys []})(highlight-rect connection {:as params, :keys []})

Highlights given rectangle.

mark-undoable-state

(mark-undoable-state)(mark-undoable-state {:as params, :keys []})(mark-undoable-state connection {:as params, :keys []})

Marks last undoable state.

move-to

(move-to)(move-to {:as params, :keys [node-id target-node-id insert-before-node-id]})(move-to connection {:as params, :keys [node-id target-node-id insert-before-node-id]})

Moves node into the new container, places it before the given anchor.

Parameters map keys:

Key Description
:node-id Id of the node to move.
:target-node-id Id of the element to drop the moved node into.
:insert-before-node-id Drop node before this one (if absent, the moved node becomes the last child of

targetNodeId). (optional)

Return map keys:

Key Description
:node-id New id of the moved node.

push-node-by-path-to-frontend

(push-node-by-path-to-frontend)(push-node-by-path-to-frontend {:as params, :keys [path]})(push-node-by-path-to-frontend connection {:as params, :keys [path]})

Requests that the node is sent to the caller given its path. // FIXME, use XPath

Parameters map keys:

Key Description
:path Path to node in the proprietary format.

Return map keys:

Key Description
:node-id Id of the node for given path.

push-nodes-by-backend-ids-to-frontend

(push-nodes-by-backend-ids-to-frontend)(push-nodes-by-backend-ids-to-frontend {:as params, :keys [backend-node-ids]})(push-nodes-by-backend-ids-to-frontend connection {:as params, :keys [backend-node-ids]})

Requests that a batch of nodes is sent to the caller given their backend node ids.

Parameters map keys:

Key Description
:backend-node-ids The array of backend node ids.

Return map keys:

Key Description
:node-ids The array of ids of pushed nodes that correspond to the backend ids specified in

backendNodeIds.

query-selector

(query-selector)(query-selector {:as params, :keys [node-id selector]})(query-selector connection {:as params, :keys [node-id selector]})

Executes querySelector on a given node.

Parameters map keys:

Key Description
:node-id Id of the node to query upon.
:selector Selector string.

Return map keys:

Key Description
:node-id Query selector result.

query-selector-all

(query-selector-all)(query-selector-all {:as params, :keys [node-id selector]})(query-selector-all connection {:as params, :keys [node-id selector]})

Executes querySelectorAll on a given node.

Parameters map keys:

Key Description
:node-id Id of the node to query upon.
:selector Selector string.

Return map keys:

Key Description
:node-ids Query selector result.

redo

(redo)(redo {:as params, :keys []})(redo connection {:as params, :keys []})

Re-does the last undone action.

remove-attribute

(remove-attribute)(remove-attribute {:as params, :keys [node-id name]})(remove-attribute connection {:as params, :keys [node-id name]})

Removes attribute with given name from an element with given id.

Parameters map keys:

Key Description
:node-id Id of the element to remove attribute from.
:name Name of the attribute to remove.

remove-node

(remove-node)(remove-node {:as params, :keys [node-id]})(remove-node connection {:as params, :keys [node-id]})

Removes node with given id.

Parameters map keys:

Key Description
:node-id Id of the node to remove.

request-child-nodes

(request-child-nodes)(request-child-nodes {:as params, :keys [node-id depth pierce]})(request-child-nodes connection {:as params, :keys [node-id depth pierce]})

Requests that children of the node with given id are returned to the caller in form of setChildNodes events where not only immediate children are retrieved, but all children down to the specified depth.

Parameters map keys:

Key Description
:node-id 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. (optional) :pierce | Whether or not iframes and shadow roots should be traversed when returning the sub-tree (default is false). (optional)

request-node

(request-node)(request-node {:as params, :keys [object-id]})(request-node connection {:as params, :keys [object-id]})

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 of setChildNodes notifications.

Parameters map keys:

Key Description
:object-id JavaScript object id to convert into node.

Return map keys:

Key Description
:node-id Node id for given object.

resolve-node

(resolve-node)(resolve-node {:as params, :keys [node-id backend-node-id object-group execution-context-id]})(resolve-node connection {:as params, :keys [node-id backend-node-id object-group execution-context-id]})

Resolves the JavaScript node object for a given NodeId or BackendNodeId.

Parameters map keys:

Key Description
:node-id Id of the node to resolve. (optional)
:backend-node-id Backend identifier of the node to resolve. (optional)
:object-group Symbolic group name that can be used to release multiple objects. (optional)
:execution-context-id Execution context in which to resolve the node. (optional)

Return map keys:

Key Description
:object JavaScript object wrapper for given node.

scroll-into-view-if-needed

(scroll-into-view-if-needed)(scroll-into-view-if-needed {:as params, :keys [node-id backend-node-id object-id rect]})(scroll-into-view-if-needed connection {:as params, :keys [node-id backend-node-id object-id 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 map keys:

Key Description
:node-id Identifier of the node. (optional)
:backend-node-id Identifier of the backend node. (optional)
:object-id JavaScript object id of the node wrapper. (optional)
:rect 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)

set-attribute-value

(set-attribute-value)(set-attribute-value {:as params, :keys [node-id name value]})(set-attribute-value connection {:as params, :keys [node-id name value]})

Sets attribute for an element with given id.

Parameters map keys:

Key Description
:node-id Id of the element to set attribute for.
:name Attribute name.
:value Attribute value.

set-attributes-as-text

(set-attributes-as-text)(set-attributes-as-text {:as params, :keys [node-id text name]})(set-attributes-as-text connection {:as params, :keys [node-id text 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 map keys:

Key Description
:node-id 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)

set-file-input-files

(set-file-input-files)(set-file-input-files {:as params, :keys [files node-id backend-node-id object-id]})(set-file-input-files connection {:as params, :keys [files node-id backend-node-id object-id]})

Sets files for the given file input element.

Parameters map keys:

Key Description
:files Array of file paths to set.
:node-id Identifier of the node. (optional)
:backend-node-id Identifier of the backend node. (optional)
:object-id JavaScript object id of the node wrapper. (optional)

set-inspected-node

(set-inspected-node)(set-inspected-node {:as params, :keys [node-id]})(set-inspected-node connection {:as params, :keys [node-id]})

Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).

Parameters map keys:

Key Description
:node-id DOM node id to be accessible by means of $x command line API.

set-node-name

(set-node-name)(set-node-name {:as params, :keys [node-id name]})(set-node-name connection {:as params, :keys [node-id name]})

Sets node name for a node with given id.

Parameters map keys:

Key Description
:node-id Id of the node to set name for.
:name New node’s name.

Return map keys:

Key Description
:node-id New node’s id.

set-node-stack-traces-enabled

(set-node-stack-traces-enabled)(set-node-stack-traces-enabled {:as params, :keys [enable]})(set-node-stack-traces-enabled connection {:as params, :keys [enable]})

Sets if stack traces should be captured for Nodes. See Node.getNodeStackTraces. Default is disabled.

Parameters map keys:

Key Description
:enable Enable or disable.

set-node-value

(set-node-value)(set-node-value {:as params, :keys [node-id value]})(set-node-value connection {:as params, :keys [node-id value]})

Sets node value for a node with given id.

Parameters map keys:

Key Description
:node-id Id of the node to set value for.
:value New node’s value.

set-outer-html

(set-outer-html)(set-outer-html {:as params, :keys [node-id outer-html]})(set-outer-html connection {:as params, :keys [node-id outer-html]})

Sets node HTML markup, returns new node id.

Parameters map keys:

Key Description
:node-id Id of the node to set markup for.
:outer-html Outer HTML markup to set.

undo

(undo)(undo {:as params, :keys []})(undo connection {:as params, :keys []})

Undoes the last performed action.