Methods

Chrome DevTools

DOMSnapshot.captureSnapshot #

Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents) in a flattened array, as well as layout and white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is flattened.

Parameters

computedStyles
array[ string ]

Whitelist of computed styles to return.

includePaintOrder
Optional
boolean

Whether to include layout object paint orders into the snapshot.

includeDOMRects
Optional
boolean

Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot

includeBlendedBackgroundColors
Optional
boolean

Whether to include blended background colors in the snapshot (default: false). Blended background color is achieved by blending background colors of all elements that overlap with the current element.

Experimental
includeTextColorOpacities
Optional
boolean

Whether to include text color opacity in the snapshot (default: false). An element might have the opacity property set that affects the text color of the element. The final text color opacity is computed based on the opacity of all overlapping elements.

Experimental

Return object

documents
array[ DocumentSnapshot ]

The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.

strings
array[ string ]

Shared string table that all string properties refer to with indexes.


Chrome DevTools

DOMSnapshot.disable #

Disables DOM snapshot agent for the given page.


Chrome DevTools

DOMSnapshot.enable #

Enables DOM snapshot agent for the given page.


Chrome DevTools

DOMSnapshot.getSnapshot Deprecated#

Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents) in a flattened array, as well as layout and white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is flattened.

Parameters

computedStyleWhitelist
array[ string ]

Whitelist of computed styles to return.

includeEventListeners
Optional
boolean

Whether or not to retrieve details of DOM listeners (default false).

includePaintOrder
Optional
boolean

Whether to determine and include the paint order index of LayoutTreeNodes (default false).

includeUserAgentShadowTree
Optional
boolean

Whether to include UA shadow tree in the snapshot (default false).

Return object

domNodes
array[ DOMNode ]

The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.

layoutTreeNodes
array[ LayoutTreeNode ]

The nodes in the layout tree.

computedStyles
array[ ComputedStyle ]

Whitelisted ComputedStyle properties for each node in the layout tree.

Types

Chrome DevTools

DOMSnapshot.ArrayOfStrings #

Index of the string in the strings table.

Type: array[ StringIndex ]


Chrome DevTools

DOMSnapshot.ComputedStyle #

A subset of the full ComputedStyle as defined by the request whitelist.

Type: object

Properties

properties
array[ NameValue ]

Name/value pairs of computed style properties.


Chrome DevTools

DOMSnapshot.DocumentSnapshot #

Document snapshot.

Type: object

Properties

documentURL
StringIndex

Document URL that Document or FrameOwner node points to.

title
StringIndex

Document title.

baseURL
StringIndex

Base URL that Document or FrameOwner node uses for URL completion.

contentLanguage
StringIndex

Contains the document's content language.

encodingName
StringIndex

Contains the document's character set encoding.

publicId
StringIndex

DocumentType node's publicId.

systemId
StringIndex

DocumentType node's systemId.

frameId
StringIndex

Frame ID for frame owner elements and also for the document node.

nodes
NodeTreeSnapshot

A table with dom nodes.

layout
LayoutTreeSnapshot

The nodes in the layout tree.

textBoxes
TextBoxSnapshot

The post-layout inline text nodes.

scrollOffsetX
Optional
number

Horizontal scroll offset.

scrollOffsetY
Optional
number

Vertical scroll offset.

contentWidth
Optional
number

Document content width.

contentHeight
Optional
number

Document content height.


Chrome DevTools

DOMSnapshot.DOMNode #

A Node in the DOM tree.

Type: object

Properties

nodeType
integer

Node's nodeType.

nodeName
string

Node's nodeName.

nodeValue
string

Node's nodeValue.

textValue
Optional
string

Only set for textarea elements, contains the text value.

inputValue
Optional
string

Only set for input elements, contains the input's associated text value.

inputChecked
Optional
boolean

Only set for radio and checkbox input elements, indicates if the element has been checked

optionSelected
Optional
boolean

Only set for option elements, indicates if the element has been selected

backendNodeId
DOM.BackendNodeId

Node's id, corresponds to DOM.Node.backendNodeId.

childNodeIndexes
Optional
array[ integer ]

The indexes of the node's child nodes in the domNodes array returned by getSnapshot, if any.

attributes
Optional
array[ NameValue ]

Attributes of an Element node.

pseudoElementIndexes
Optional
array[ integer ]

Indexes of pseudo elements associated with this node in the domNodes array returned by getSnapshot, if any.

layoutNodeIndex
Optional
integer

The index of the node's related layout tree node in the layoutTreeNodes array returned by getSnapshot, if any.

documentURL
Optional
string

Document URL that Document or FrameOwner node points to.

baseURL
Optional
string

Base URL that Document or FrameOwner node uses for URL completion.

contentLanguage
Optional
string

Only set for documents, contains the document's content language.

documentEncoding
Optional
string

Only set for documents, contains the document's character set encoding.

publicId
Optional
string

DocumentType node's publicId.

systemId
Optional
string

DocumentType node's systemId.

frameId
Optional
Page.FrameId

Frame ID for frame owner elements and also for the document node.

contentDocumentIndex
Optional
integer

The index of a frame owner element's content document in the domNodes array returned by getSnapshot, if any.

pseudoType
Optional
DOM.PseudoType

Type of a pseudo element node.

shadowRootType
Optional
DOM.ShadowRootType

Shadow root type.

isClickable
Optional
boolean

Whether this DOM node responds to mouse clicks. This includes nodes that have had click event listeners attached via JavaScript as well as anchor tags that naturally navigate when clicked.

eventListeners
Optional
array[ DOMDebugger.EventListener ]

Details of the node's event listeners, if any.

currentSourceURL
Optional
string

The selected url for nodes with a srcset attribute.

originURL
Optional
string

The url of the script (if any) that generates this node.

scrollOffsetX
Optional
number

Scroll offsets, set when this node is a Document.

scrollOffsetY
Optional
number

Chrome DevTools

DOMSnapshot.InlineTextBox #

Details of post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.

Type: object

Properties

boundingBox
DOM.Rect

The bounding box in document coordinates. Note that scroll offset of the document is ignored.

startCharacterIndex
integer

The starting index in characters, for this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2.

numCharacters
integer

The number of characters in this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2.


Chrome DevTools

DOMSnapshot.LayoutTreeNode #

Details of an element in the DOM tree with a LayoutObject.

Type: object

Properties

domNodeIndex
integer

The index of the related DOM node in the domNodes array returned by getSnapshot.

boundingBox
DOM.Rect

The bounding box in document coordinates. Note that scroll offset of the document is ignored.

layoutText
Optional
string

Contents of the LayoutText, if any.

inlineTextNodes
Optional
array[ InlineTextBox ]

The post-layout inline text nodes, if any.

styleIndex
Optional
integer

Index into the computedStyles array returned by getSnapshot.

paintOrder
Optional
integer

Global paint order index, which is determined by the stacking order of the nodes. Nodes that are painted together will have the same index. Only provided if includePaintOrder in getSnapshot was true.

isStackingContext
Optional
boolean

Set to true to indicate the element begins a new stacking context.


Chrome DevTools

DOMSnapshot.LayoutTreeSnapshot #

Table of details of an element in the DOM tree with a LayoutObject.

Type: object

Properties

nodeIndex
array[ integer ]

Index of the corresponding node in the NodeTreeSnapshot array returned by captureSnapshot.

styles
array[ ArrayOfStrings ]

Array of indexes specifying computed style strings, filtered according to the computedStyles parameter passed to captureSnapshot.

bounds
array[ Rectangle ]

The absolute position bounding box.

text
array[ StringIndex ]

Contents of the LayoutText, if any.

stackingContexts
RareBooleanData

Stacking context information.

paintOrders
Optional
array[ integer ]

Global paint order index, which is determined by the stacking order of the nodes. Nodes that are painted together will have the same index. Only provided if includePaintOrder in captureSnapshot was true.

offsetRects
Optional
array[ Rectangle ]

The offset rect of nodes. Only available when includeDOMRects is set to true

scrollRects
Optional
array[ Rectangle ]

The scroll rect of nodes. Only available when includeDOMRects is set to true

clientRects
Optional
array[ Rectangle ]

The client rect of nodes. Only available when includeDOMRects is set to true

blendedBackgroundColors
Optional
array[ StringIndex ]

The list of background colors that are blended with colors of overlapping elements.

Experimental
textColorOpacities
Optional
array[ number ]

The list of computed text opacities.

Experimental

Chrome DevTools

DOMSnapshot.NameValue #

A name/value pair.

Type: object

Properties

name
string

Attribute/property name.

value
string

Attribute/property value.


Chrome DevTools

DOMSnapshot.NodeTreeSnapshot #

Table containing nodes.

Type: object

Properties

parentIndex
Optional
array[ integer ]

Parent node index.

nodeType
Optional
array[ integer ]

Node's nodeType.

shadowRootType
Optional
RareStringData

Type of the shadow root the Node is in. String values are equal to the ShadowRootType enum.

nodeName
Optional
array[ StringIndex ]

Node's nodeName.

nodeValue
Optional
array[ StringIndex ]

Node's nodeValue.

backendNodeId
Optional
array[ DOM.BackendNodeId ]

Node's id, corresponds to DOM.Node.backendNodeId.

attributes
Optional
array[ ArrayOfStrings ]

Attributes of an Element node. Flatten name, value pairs.

textValue
Optional
RareStringData

Only set for textarea elements, contains the text value.

inputValue
Optional
RareStringData

Only set for input elements, contains the input's associated text value.

inputChecked
Optional
RareBooleanData

Only set for radio and checkbox input elements, indicates if the element has been checked

optionSelected
Optional
RareBooleanData

Only set for option elements, indicates if the element has been selected

contentDocumentIndex
Optional
RareIntegerData

The index of the document in the list of the snapshot documents.

pseudoType
Optional
RareStringData

Type of a pseudo element node.

pseudoIdentifier
Optional
RareStringData

Pseudo element identifier for this node. Only present if there is a valid pseudoType.

isClickable
Optional
RareBooleanData

Whether this DOM node responds to mouse clicks. This includes nodes that have had click event listeners attached via JavaScript as well as anchor tags that naturally navigate when clicked.

currentSourceURL
Optional
RareStringData

The selected url for nodes with a srcset attribute.

originURL
Optional
RareStringData

The url of the script (if any) that generates this node.


Chrome DevTools

DOMSnapshot.RareBooleanData #

Type: object

Properties

index
array[ integer ]

Chrome DevTools

DOMSnapshot.RareIntegerData #

Type: object

Properties

index
array[ integer ]
value
array[ integer ]

Chrome DevTools

DOMSnapshot.RareStringData #

Data that is only present on rare nodes.

Type: object

Properties

index
array[ integer ]
value
array[ StringIndex ]

Chrome DevTools

DOMSnapshot.Rectangle #

Type: array[ number ]


Chrome DevTools

DOMSnapshot.StringIndex #

Index of the string in the strings table.

Type: integer


Chrome DevTools

DOMSnapshot.TextBoxSnapshot #

Table of details of the post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.

Type: object

Properties

layoutIndex
array[ integer ]

Index of the layout tree node that owns this box collection.

bounds
array[ Rectangle ]

The absolute position bounding box.

start
array[ integer ]

The starting index in characters, for this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2.

length
array[ integer ]

The number of characters in this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2.