DOMSnapshot Domain
This domain facilitates obtaining document snapshots with DOM, layout, and style information.
Methods
- DOMSnapshot.captureSnapshot
- DOMSnapshot.disable
- DOMSnapshot.enable
- DOMSnapshot.getSnapshot Deprecated
Types
- DOMSnapshot.ArrayOfStrings
- DOMSnapshot.ComputedStyle
- DOMSnapshot.DocumentSnapshot
- DOMSnapshot.DOMNode
- DOMSnapshot.InlineTextBox
- DOMSnapshot.LayoutTreeNode
- DOMSnapshot.LayoutTreeSnapshot
- DOMSnapshot.NameValue
- DOMSnapshot.NodeTreeSnapshot
- DOMSnapshot.RareBooleanData
- DOMSnapshot.RareIntegerData
- DOMSnapshot.RareStringData
- DOMSnapshot.Rectangle
- DOMSnapshot.StringIndex
- DOMSnapshot.TextBoxSnapshot
Methods
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.
includePaintOrderOptional
booleanWhether to include layout object paint orders into the snapshot.
includeDOMRectsOptional
booleanWhether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot
includeBlendedBackgroundColorsOptional
booleanWhether 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.
includeTextColorOpacitiesOptional
booleanWhether 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.
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.
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.
includeEventListenersOptional
booleanWhether or not to retrieve details of DOM listeners (default false).
includePaintOrderOptional
booleanWhether to determine and include the paint order index of LayoutTreeNodes (default false).
includeUserAgentShadowTreeOptional
booleanWhether 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
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.
DOMSnapshot.DocumentSnapshot #
Document snapshot.
Type: object
Properties
documentURL Document URL that Document or FrameOwner node points to.
title Document title.
baseURL Base URL that Document or FrameOwner node uses for URL completion.
contentLanguage Contains the document's content language.
encodingName Contains the document's character set encoding.
publicId DocumentType node's publicId.
systemId DocumentType node's systemId.
frameId Frame ID for frame owner elements and also for the document node.
nodes A table with dom nodes.
layout The nodes in the layout tree.
textBoxes The post-layout inline text nodes.
scrollOffsetXOptional
numberHorizontal scroll offset.
scrollOffsetYOptional
numberVertical scroll offset.
contentWidthOptional
numberDocument content width.
contentHeightOptional
numberDocument content height.
DOMSnapshot.DOMNode #
A Node in the DOM tree.
Type: object
Properties
nodeType integerNode's nodeType.
nodeName stringNode's nodeName.
nodeValue stringNode's nodeValue.
textValueOptional
stringOnly set for textarea elements, contains the text value.
inputValueOptional
stringOnly set for input elements, contains the input's associated text value.
inputCheckedOptional
booleanOnly set for radio and checkbox input elements, indicates if the element has been checked
optionSelectedOptional
booleanOnly set for option elements, indicates if the element has been selected
backendNodeId Node's id, corresponds to DOM.Node.backendNodeId.
childNodeIndexesOptional
array[ integer ]The indexes of the node's child nodes in the domNodes array returned by getSnapshot, if
any.
attributesOptional
array[ NameValue ]Attributes of an Element node.
pseudoElementIndexesOptional
array[ integer ]Indexes of pseudo elements associated with this node in the domNodes array returned by
getSnapshot, if any.
layoutNodeIndexOptional
integerThe index of the node's related layout tree node in the layoutTreeNodes array returned by
getSnapshot, if any.
documentURLOptional
stringDocument URL that Document or FrameOwner node points to.
baseURLOptional
stringBase URL that Document or FrameOwner node uses for URL completion.
contentLanguageOptional
stringOnly set for documents, contains the document's content language.
documentEncodingOptional
stringOnly set for documents, contains the document's character set encoding.
publicIdOptional
stringDocumentType node's publicId.
systemIdOptional
stringDocumentType node's systemId.
frameIdOptional
Frame ID for frame owner elements and also for the document node.
contentDocumentIndexOptional
integerThe index of a frame owner element's content document in the domNodes array returned by
getSnapshot, if any.
pseudoTypeOptional
Type of a pseudo element node.
shadowRootTypeOptional
Shadow root type.
isClickableOptional
booleanWhether 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.
eventListenersOptional
array[ DOMDebugger.EventListener ]Details of the node's event listeners, if any.
currentSourceURLOptional
stringThe selected url for nodes with a srcset attribute.
originURLOptional
stringThe url of the script (if any) that generates this node.
scrollOffsetXOptional
numberScroll offsets, set when this node is a Document.
scrollOffsetYOptional
numberDOMSnapshot.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 The bounding box in document coordinates. Note that scroll offset of the document is ignored.
startCharacterIndex integerThe 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 integerThe number of characters in this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2.
DOMSnapshot.LayoutTreeNode #
Details of an element in the DOM tree with a LayoutObject.
Type: object
Properties
domNodeIndex integerThe index of the related DOM node in the domNodes array returned by getSnapshot.
boundingBox The bounding box in document coordinates. Note that scroll offset of the document is ignored.
layoutTextOptional
stringContents of the LayoutText, if any.
inlineTextNodesOptional
array[ InlineTextBox ]The post-layout inline text nodes, if any.
styleIndexOptional
integerIndex into the computedStyles array returned by getSnapshot.
paintOrderOptional
integerGlobal 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.
isStackingContextOptional
booleanSet to true to indicate the element begins a new stacking context.
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 Stacking context information.
paintOrdersOptional
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.
offsetRectsOptional
array[ Rectangle ]The offset rect of nodes. Only available when includeDOMRects is set to true
scrollRectsOptional
array[ Rectangle ]The scroll rect of nodes. Only available when includeDOMRects is set to true
clientRectsOptional
array[ Rectangle ]The client rect of nodes. Only available when includeDOMRects is set to true
blendedBackgroundColorsOptional
array[ StringIndex ]The list of background colors that are blended with colors of overlapping elements.
textColorOpacitiesOptional
array[ number ]The list of computed text opacities.
DOMSnapshot.NameValue #
A name/value pair.
Type: object
Properties
name stringAttribute/property name.
value stringAttribute/property value.
DOMSnapshot.NodeTreeSnapshot #
Table containing nodes.
Type: object
Properties
parentIndexOptional
array[ integer ]Parent node index.
nodeTypeOptional
array[ integer ]Node's nodeType.
shadowRootTypeOptional
Type of the shadow root the Node is in. String values are equal to the ShadowRootType enum.
nodeNameOptional
array[ StringIndex ]Node's nodeName.
nodeValueOptional
array[ StringIndex ]Node's nodeValue.
backendNodeIdOptional
array[ DOM.BackendNodeId ]Node's id, corresponds to DOM.Node.backendNodeId.
attributesOptional
array[ ArrayOfStrings ]Attributes of an Element node. Flatten name, value pairs.
textValueOptional
Only set for textarea elements, contains the text value.
inputValueOptional
Only set for input elements, contains the input's associated text value.
inputCheckedOptional
Only set for radio and checkbox input elements, indicates if the element has been checked
optionSelectedOptional
Only set for option elements, indicates if the element has been selected
contentDocumentIndexOptional
The index of the document in the list of the snapshot documents.
pseudoTypeOptional
Type of a pseudo element node.
pseudoIdentifierOptional
Pseudo element identifier for this node. Only present if there is a valid pseudoType.
isClickableOptional
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.
currentSourceURLOptional
The selected url for nodes with a srcset attribute.
originURLOptional
The url of the script (if any) that generates this node.
DOMSnapshot.RareStringData #
Data that is only present on rare nodes.
Type: object
Properties
index array[ integer ]value array[ StringIndex ]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.