DOM Domain
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.
Methods
- DOM.disable
- DOM.enable
- DOM.getAttributes
- DOM.getDocument
- DOM.getOuterHTML
- DOM.hideHighlight
- DOM.highlightNode
- DOM.highlightRect
- DOM.moveTo
- DOM.querySelector
- DOM.querySelectorAll
- DOM.removeAttribute
- DOM.removeNode
- DOM.requestChildNodes
- DOM.requestNode
- DOM.resolveNode
- DOM.setAttributesAsText
- DOM.setAttributeValue
- DOM.setNodeName
- DOM.setNodeValue
- DOM.setOuterHTML
Events
- DOM.attributeModified
- DOM.attributeRemoved
- DOM.characterDataModified
- DOM.childNodeCountUpdated
- DOM.childNodeInserted
- DOM.childNodeRemoved
- DOM.documentUpdated
- DOM.setChildNodes
Types
Methods
DOM.getAttributes #
Returns attributes for the specified node.
Parameters
nodeId Id of the node to retrieve attibutes for.
Return object
attributes array[ string ]An interleaved array of node attribute names and values.
DOM.getOuterHTML #
Returns node's HTML markup.
Parameters
nodeId Id of the node to get markup for.
Return object
outerHTML stringOuter HTML markup.
DOM.highlightNode #
Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified.
Parameters
highlightConfig A descriptor for the highlight appearance.
nodeIdOptional
Identifier of the node to highlight.
backendNodeIdOptional
Identifier of the backend node to highlight.
objectIdOptional
DOM.highlightRect #
Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.
Parameters
x integerX coordinate
y integerY coordinate
width integerRectangle width
height integerRectangle height
colorOptional
The highlight fill color (default: transparent).
outlineColorOptional
The highlight outline color (default: transparent).
DOM.moveTo #
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.
insertBeforeNodeIdOptional
Drop node before this one (if absent, the moved node becomes the last child of targetNodeId).
Return object
nodeId New id of the moved node.
DOM.querySelector #
Executes querySelector on a given node.
Parameters
nodeId Id of the node to query upon.
selector stringSelector string.
Return object
nodeId Query selector result.
DOM.querySelectorAll #
Executes querySelectorAll on a given node.
Parameters
nodeId Id of the node to query upon.
selector stringSelector string.
Return object
nodeIds array[ NodeId ]Query selector result.
DOM.removeAttribute #
Removes attribute with given name from an element with given id.
Parameters
nodeId Id of the element to remove attribute from.
name stringName of the attribute to remove.
DOM.requestChildNodes #
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
nodeId Id of the node to get children for.
depthOptional
integerThe maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
DOM.requestNode #
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
objectId JavaScript object id to convert into node.
Return object
nodeId Node id for given object.
DOM.resolveNode #
Resolves JavaScript node object for given node id.
Parameters
nodeId Id of the node to resolve.
objectGroupOptional
stringSymbolic group name that can be used to release multiple objects.
Return object
object JavaScript object wrapper for given node.
DOM.setAttributesAsText #
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 stringText with a number of attributes. Will parse this text using HTML parser.
nameOptional
stringAttribute name to replace with new attributes derived from text in case text parsed successfully.
DOM.setAttributeValue #
Sets attribute for an element with given id.
Parameters
nodeId Id of the element to set attribute for.
name stringAttribute name.
value stringAttribute value.
DOM.setNodeName #
Sets node name for a node with given id.
Parameters
nodeId Id of the node to set name for.
name stringNew node's name.
Return object
nodeId New node's id.
Events
DOM.attributeModified #
Fired when Element's attribute is modified.
Parameters
nodeId Id of the node that has changed.
name stringAttribute name.
value stringAttribute value.
DOM.attributeRemoved #
Fired when Element's attribute is removed.
Parameters
nodeId Id of the node that has changed.
name stringA ttribute name.
DOM.characterDataModified #
Mirrors DOMCharacterDataModified event.
Parameters
nodeId Id of the node that has changed.
characterData stringNew text value.
DOM.childNodeCountUpdated #
Fired when Container's child node count has changed.
Parameters
nodeId Id of the node that has changed.
childNodeCount integerNew node count.
DOM.childNodeInserted #
Mirrors DOMNodeInserted event.
Parameters
parentNodeId Id of the node that has changed.
previousNodeId If of the previous siblint.
node Inserted node data.
Types
DOM.HighlightConfig #
Configuration data for the highlighting of page elements.
Type: object
Properties
showInfoOptional
booleanWhether the node info tooltip should be shown (default: false).
showRulersOptional
booleanWhether the rulers should be shown (default: false).
showExtensionLinesOptional
booleanWhether the extension lines from node to the rulers should be shown (default: false).
displayAsMaterialOptional
booleanExperimentalcontentColorOptional
The content box highlight fill color (default: transparent).
paddingColorOptional
The padding highlight fill color (default: transparent).
borderColorOptional
The border highlight fill color (default: transparent).
marginColorOptional
The margin highlight fill color (default: transparent).
eventTargetColorOptional
shapeColorOptional
shapeMarginColorOptional
selectorListOptional
stringSelectors to highlight relevant nodes.
DOM.Node #
DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type.
Type: object
Properties
nodeId Node identifier that is passed into the rest of the DOM messages as the nodeId. Backend will only push node with given id once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client.
nodeType integerNode's nodeType.
nodeName stringNode's nodeName.
localName stringNode's localName.
nodeValue stringNode's nodeValue.
childNodeCountOptional
integerChild count for Container nodes.
childrenOptional
array[ Node ]Child nodes of this node when requested with children.
attributesOptional
array[ string ]Attributes of the Element node in the form of flat array [name1, value1, name2, value2].
documentURLOptional
stringDocument URL that Document or FrameOwner node points to.
baseURLOptional
stringBase URL that Document or FrameOwner node uses for URL completion.
publicIdOptional
stringDocumentType's publicId.
systemIdOptional
stringDocumentType's systemId.
internalSubsetOptional
stringDocumentType's internalSubset.
xmlVersionOptional
stringDocument's XML version in case of XML documents.
nameOptional
stringAttr's name.
valueOptional
stringAttr's value.
pseudoTypeOptional
Pseudo element type for this node.
shadowRootTypeOptional
Shadow root type.
frameIdOptional
contentDocumentOptional
Content document for frame owner elements.
shadowRootsOptional
templateContentOptional
pseudoElementsOptional
importedDocumentOptional
Import document for the HTMLImport links.
distributedNodesOptional
DOM.PseudoType #
Pseudo element type.
Type: string
Allowed values: first-line, first-letter, before, after, backdrop, selection, first-line-inherited, scrollbar, scrollbar-thumb, scrollbar-button, scrollbar-track, scrollbar-track-piece, scrollbar-corner, resizer, input-list-button
DOM.RGBA #
A structure holding an RGBA color.
Type: object
Properties
r integerThe red component, in the [0-255] range.
g integerThe green component, in the [0-255] range.
b integerThe blue component, in the [0-255] range.
aOptional
numberThe alpha component, in the [0-1] range (default: 1).