# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Contributing to Chrome DevTools Protocol: https://goo.gle/devtools-contribution-guide-cdp
# 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.
domain DOM
depends on Runtime
# Unique DOM node identifier.
type NodeId extends integer
# Unique DOM node identifier used to reference a node that may not have been pushed to the
# front-end.
type BackendNodeId extends integer
# Unique identifier for a CSS stylesheet.
type StyleSheetId extends string
# Backend node with a friendly name.
type BackendNode extends object
properties
# `Node`'s nodeType.
integer nodeType
# `Node`'s nodeName.
string nodeName
BackendNodeId backendNodeId
# Pseudo element type.
type PseudoType extends string
enum
first-line
first-letter
checkmark
before
after
picker-icon
interest-hint
marker
backdrop
column
selection
search-text
target-text
spelling-error
grammar-error
highlight
first-line-inherited
scroll-marker
scroll-marker-group
scroll-button
scrollbar
scrollbar-thumb
scrollbar-button
scrollbar-track
scrollbar-track-piece
scrollbar-corner
resizer
input-list-button
view-transition
view-transition-group
view-transition-image-pair
view-transition-group-children
view-transition-old
view-transition-new
placeholder
file-selector-button
details-content
picker
permission-icon
overscroll-area-parent
# Shadow root type.
type ShadowRootType extends string
enum
user-agent
open
closed
# Document compatibility mode.
type CompatibilityMode extends string
enum
QuirksMode
LimitedQuirksMode
NoQuirksMode
# ContainerSelector physical axes
type PhysicalAxes extends string
enum
Horizontal
Vertical
Both
# ContainerSelector logical axes
type LogicalAxes extends string
enum
Inline
Block
Both
# Physical scroll orientation
type ScrollOrientation extends string
enum
horizontal
vertical
# DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes.
# DOMNode is a base node mirror type.
type Node extends object
properties
# 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.
NodeId nodeId
# The id of the parent node if any.
optional NodeId parentId
# The BackendNodeId for this node.
BackendNodeId backendNodeId
# `Node`'s nodeType.
integer nodeType
# `Node`'s nodeName.
string nodeName
# `Node`'s localName.
string localName
# `Node`'s nodeValue.
string nodeValue
# Child count for `Container` nodes.
optional integer childNodeCount
# Child nodes of this node when requested with children.
optional array of Node children
# Attributes of the `Element` node in the form of flat array `[name1, value1, name2, value2]`.
optional array of string attributes
# Document URL that `Document` or `FrameOwner` node points to.
optional string documentURL
# Base URL that `Document` or `FrameOwner` node uses for URL completion.
optional string baseURL
# `DocumentType`'s publicId.
optional string publicId
# `DocumentType`'s systemId.
optional string systemId
# `DocumentType`'s internalSubset.
optional string internalSubset
# `Document`'s XML version in case of XML documents.
optional string xmlVersion
# `Attr`'s name.
optional string name
# `Attr`'s value.
optional string value
# Pseudo element type for this node.
optional PseudoType pseudoType
# Pseudo element identifier for this node. Only present if there is a
# valid pseudoType.
optional string pseudoIdentifier
# Shadow root type.
optional ShadowRootType shadowRootType
# Frame ID for frame owner elements.
optional Page.FrameId frameId
# Content document for frame owner elements.
optional Node contentDocument
# Shadow root list for given element host.
optional array of Node shadowRoots
# Content document fragment for template elements.
optional Node templateContent
# Pseudo elements associated with this node.
optional array of Node pseudoElements
# Deprecated, as the HTML Imports API has been removed (crbug.com/937746).
# This property used to return the imported document for the HTMLImport links.
# The property is always undefined now.
deprecated optional Node importedDocument
# Distributed nodes for given insertion point.
optional array of BackendNode distributedNodes
# Whether the node is SVG.
optional boolean isSVG
optional CompatibilityMode compatibilityMode
optional BackendNode assignedSlot
experimental optional boolean isScrollable
experimental optional boolean affectedByStartingStyles
experimental optional array of StyleSheetId adoptedStyleSheets
experimental optional boolean isAdRelated
# A structure to hold the top-level node of a detached tree and an array of its retained descendants.
type DetachedElementInfo extends object
properties
Node treeNode
array of NodeId retainedNodeIds
# A structure holding an RGBA color.
type RGBA extends object
properties
# The red component, in the [0-255] range.
integer r
# The green component, in the [0-255] range.
integer g
# The blue component, in the [0-255] range.
integer b
# The alpha component, in the [0-1] range (default: 1).
optional number a
# An array of quad vertices, x immediately followed by y for each point, points clock-wise.
type Quad extends array of number
# Box model.
type BoxModel extends object
properties
# Content box
Quad content
# Padding box
Quad padding
# Border box
Quad border
# Margin box
Quad margin
# Node width
integer width
# Node height
integer height
# Shape outside coordinates
optional ShapeOutsideInfo shapeOutside
# CSS Shape Outside details.
type ShapeOutsideInfo extends object
properties
# Shape bounds
Quad bounds
# Shape coordinate details
array of any shape
# Margin shape bounds
array of any marginShape
# Rectangle.
type Rect extends object
properties
# X coordinate
number x
# Y coordinate
number y
# Rectangle width
number width
# Rectangle height
number height
type CSSComputedStyleProperty extends object
properties
# Computed style property name.
string name
# Computed style property value.
string value
# Collects class names for the node with given id and all of it's child nodes.
experimental command collectClassNamesFromSubtree
parameters
# Id of the node to collect class names.
NodeId nodeId
returns
# Class name list.
array of string classNames
# Creates a deep copy of the specified node and places it into the target container before the
# given anchor.
experimental command copyTo
parameters
# Id of the node to copy.
NodeId nodeId
# Id of the element to drop the copy into.
NodeId targetNodeId
# Drop the copy before this node (if absent, the copy becomes the last child of
# `targetNodeId`).
optional NodeId insertBeforeNodeId
returns
# Id of the node clone.
NodeId nodeId
# Describes node given its id, does not require domain to be enabled. Does not start tracking any
# objects, can be used for automation.
command describeNode
parameters
# Identifier of the node.
optional NodeId nodeId
# Identifier of the backend node.
optional BackendNodeId backendNodeId
# JavaScript object id of the node wrapper.
optional Runtime.RemoteObjectId objectId
# 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 integer depth
# Whether or not iframes and shadow roots should be traversed when returning the subtree
# (default is false).
optional boolean pierce
returns
# Node description.
Node node
# 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.
command scrollIntoViewIfNeeded
parameters
# Identifier of the node.
optional NodeId nodeId
# Identifier of the backend node.
optional BackendNodeId backendNodeId
# JavaScript object id of the node wrapper.
optional Runtime.RemoteObjectId objectId
# 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 Rect rect
# Disables DOM agent for the given page.
command disable
# Discards search results from the session with the given id. `getSearchResults` should no longer
# be called for that search.
experimental command discardSearchResults
parameters
# Unique search session identifier.
string searchId
# Enables DOM agent for the given page.
command enable
parameters
# Whether to include whitespaces in the children array of returned Nodes.
experimental optional enum includeWhitespace
# Strip whitespaces from child arrays (default).
none
# Return all children including block-level whitespace nodes.
all
# Focuses the given element.
command focus
parameters
# Identifier of the node.
optional NodeId nodeId
# Identifier of the backend node.
optional BackendNodeId backendNodeId
# JavaScript object id of the node wrapper.
optional Runtime.RemoteObjectId objectId
# Returns attributes for the specified node.
command getAttributes
parameters
# Id of the node to retrieve attributes for.
NodeId nodeId
returns
# An interleaved array of node attribute names and values.
array of string attributes
# Returns boxes for the given node.
command getBoxModel
parameters
# Identifier of the node.
optional NodeId nodeId
# Identifier of the backend node.
optional BackendNodeId backendNodeId
# JavaScript object id of the node wrapper.
optional Runtime.RemoteObjectId objectId
returns
# Box model for the node.
BoxModel model
# Returns quads that describe node position on the page. This method
# might return multiple quads for inline nodes.
experimental command getContentQuads
parameters
# Identifier of the node.
optional NodeId nodeId
# Identifier of the backend node.
optional BackendNodeId backendNodeId
# JavaScript object id of the node wrapper.
optional Runtime.RemoteObjectId objectId
returns
# Quads that describe node layout relative to viewport.
array of Quad quads
# Returns the root DOM node (and optionally the subtree) to the caller.
# Implicitly enables the DOM domain events for the current target.
command getDocument
parameters
# 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 integer depth
# Whether or not iframes and shadow roots should be traversed when returning the subtree
# (default is false).
optional boolean pierce
returns
# Resulting node.
Node root
# 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 command getFlattenedDocument
parameters
# 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 integer depth
# Whether or not iframes and shadow roots should be traversed when returning the subtree
# (default is false).
optional boolean pierce
returns
# Resulting node.
array of Node nodes
# Finds nodes with a given computed style in a subtree.
experimental command getNodesForSubtreeByStyle
parameters
# Node ID pointing to the root of a subtree.
NodeId nodeId
# The style to filter nodes by (includes nodes if any of properties matches).
array of CSSComputedStyleProperty computedStyles
# Whether or not iframes and shadow roots in the same target should be traversed when returning the
# results (default is false).
optional boolean pierce
returns
# Resulting nodes.
array of NodeId nodeIds
# Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is
# either returned or not.
command getNodeForLocation
parameters
# X coordinate.
integer x
# Y coordinate.
integer y
# False to skip to the nearest non-UA shadow root ancestor (default: false).
optional boolean includeUserAgentShadowDOM
# Whether to ignore pointer-events: none on elements and hit test them.
optional boolean ignorePointerEventsNone
returns
# Resulting node.
BackendNodeId backendNodeId
# Frame this node belongs to.
Page.FrameId frameId
# Id of the node at given coordinates, only when enabled and requested document.
optional NodeId nodeId
# Returns node's HTML markup.
command getOuterHTML
parameters
# Identifier of the node.
optional NodeId nodeId
# Identifier of the backend node.
optional BackendNodeId backendNodeId
# JavaScript object id of the node wrapper.
optional Runtime.RemoteObjectId objectId
# Include all shadow roots. Equals to false if not specified.
experimental optional boolean includeShadowDOM
returns
# Outer HTML markup.
string outerHTML
# Returns the id of the nearest ancestor that is a relayout boundary.
experimental command getRelayoutBoundary
parameters
# Id of the node.
NodeId nodeId
returns
# Relayout boundary node id for the given node.
NodeId nodeId
# Returns search results from given `fromIndex` to given `toIndex` from the search with the given
# identifier.
experimental command getSearchResults
parameters
# Unique search session identifier.
string searchId
# Start index of the search result to be returned.
integer fromIndex
# End index of the search result to be returned.
integer toIndex
returns
# Ids of the search result nodes.
array of NodeId nodeIds
# Hides any highlight.
command hideHighlight
# Use 'Overlay.hideHighlight' instead
redirect Overlay
# Highlights DOM node.
command highlightNode
# Use 'Overlay.highlightNode' instead
redirect Overlay
# Highlights given rectangle.
command highlightRect
# Use 'Overlay.highlightRect' instead
redirect Overlay
# Marks last undoable state.
experimental command markUndoableState
# Moves node into the new container, places it before the given anchor.
command moveTo
parameters
# Id of the node to move.
NodeId nodeId
# Id of the element to drop the moved node into.
NodeId targetNodeId
# Drop node before this one (if absent, the moved node becomes the last child of
# `targetNodeId`).
optional NodeId insertBeforeNodeId
returns
# New id of the moved node.
NodeId nodeId
# Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or
# `cancelSearch` to end this search session.
experimental command performSearch
parameters
# Plain text or query selector or XPath search query.
string query
# True to search in user agent shadow DOM.
optional boolean includeUserAgentShadowDOM
returns
# Unique search session identifier.
string searchId
# Number of search results.
integer resultCount
# Requests that the node is sent to the caller given its path. // FIXME, use XPath
experimental command pushNodeByPathToFrontend
parameters
# Path to node in the proprietary format.
string path
returns
# Id of the node for given path.
NodeId nodeId
# Requests that a batch of nodes is sent to the caller given their backend node ids.
experimental command pushNodesByBackendIdsToFrontend
parameters
# The array of backend node ids.
array of BackendNodeId backendNodeIds
returns
# The array of ids of pushed nodes that correspond to the backend ids specified in
# backendNodeIds.
array of NodeId nodeIds
# Executes `querySelector` on a given node.
command querySelector
parameters
# Id of the node to query upon.
NodeId nodeId
# Selector string.
string selector
returns
# Query selector result.
NodeId nodeId
# Executes `querySelectorAll` on a given node.
command querySelectorAll
parameters
# Id of the node to query upon.
NodeId nodeId
# Selector string.
string selector
returns
# Query selector result.
array of NodeId nodeIds
# 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 command getTopLayerElements
returns
# NodeIds of top layer elements
array of NodeId nodeIds
# Returns the NodeId of the matched element according to certain relations.
experimental command getElementByRelation
parameters
# Id of the node from which to query the relation.
NodeId nodeId
# Type of relation to get.
enum relation
# Get the popover target for a given element. In this case, this given
# element can only be an HTMLFormControlElement (,