DOMSnapshot

class DOMSnapshot(cdp: CDP) : Domain

This domain facilitates obtaining document snapshots with DOM, layout, and style information.

Constructors

Link copied to clipboard
constructor(cdp: CDP)

Types

Link copied to clipboard
@Serializable
data class CaptureSnapshotParameter(val computedStyles: List<String>, val includePaintOrder: Boolean? = null, val includeDOMRects: Boolean? = null, val includeBlendedBackgroundColors: Boolean? = null, val includeTextColorOpacities: Boolean? = null)
Link copied to clipboard
@Serializable
data class CaptureSnapshotReturn(val documents: List<DOMSnapshot.DocumentSnapshot>, val strings: List<String>)
Link copied to clipboard
@Serializable
data class ComputedStyle(val properties: List<DOMSnapshot.NameValue>)

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

Link copied to clipboard
@Serializable
data class DocumentSnapshot(val documentURL: Int, val title: Int, val baseURL: Int, val contentLanguage: Int, val encodingName: Int, val publicId: Int, val systemId: Int, val frameId: Int, val nodes: DOMSnapshot.NodeTreeSnapshot, val layout: DOMSnapshot.LayoutTreeSnapshot, val textBoxes: DOMSnapshot.TextBoxSnapshot, val scrollOffsetX: Double? = null, val scrollOffsetY: Double? = null, val contentWidth: Double? = null, val contentHeight: Double? = null)

Document snapshot.

Link copied to clipboard
@Serializable
data class DOMNode(val nodeType: Int, val nodeName: String, val nodeValue: String, val textValue: String? = null, val inputValue: String? = null, val inputChecked: Boolean? = null, val optionSelected: Boolean? = null, val backendNodeId: Int, val childNodeIndexes: List<Int>? = null, val attributes: List<DOMSnapshot.NameValue>? = null, val pseudoElementIndexes: List<Int>? = null, val layoutNodeIndex: Int? = null, val documentURL: String? = null, val baseURL: String? = null, val contentLanguage: String? = null, val documentEncoding: String? = null, val publicId: String? = null, val systemId: String? = null, val frameId: String? = null, val contentDocumentIndex: Int? = null, val pseudoType: DOM.PseudoType? = null, val shadowRootType: DOM.ShadowRootType? = null, val isClickable: Boolean? = null, val eventListeners: List<DOMDebugger.EventListener>? = null, val currentSourceURL: String? = null, val originURL: String? = null, val scrollOffsetX: Double? = null, val scrollOffsetY: Double? = null)

A Node in the DOM tree.

Link copied to clipboard
@Serializable
data class GetSnapshotParameter(val computedStyleWhitelist: List<String>, val includeEventListeners: Boolean? = null, val includePaintOrder: Boolean? = null, val includeUserAgentShadowTree: Boolean? = null)
Link copied to clipboard
@Serializable
data class GetSnapshotReturn(val domNodes: List<DOMSnapshot.DOMNode>, val layoutTreeNodes: List<DOMSnapshot.LayoutTreeNode>, val computedStyles: List<DOMSnapshot.ComputedStyle>)
Link copied to clipboard
@Serializable
data class InlineTextBox(val boundingBox: DOM.Rect, val startCharacterIndex: Int, val numCharacters: Int)

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

Link copied to clipboard
@Serializable
data class LayoutTreeNode(val domNodeIndex: Int, val boundingBox: DOM.Rect, val layoutText: String? = null, val inlineTextNodes: List<DOMSnapshot.InlineTextBox>? = null, val styleIndex: Int? = null, val paintOrder: Int? = null, val isStackingContext: Boolean? = null)

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

Link copied to clipboard
@Serializable
data class LayoutTreeSnapshot(val nodeIndex: List<Int>, val styles: List<List<Double>>, val bounds: List<List<Double>>, val text: List<Int>, val stackingContexts: DOMSnapshot.RareBooleanData, val paintOrders: List<Int>? = null, val offsetRects: List<List<Double>>? = null, val scrollRects: List<List<Double>>? = null, val clientRects: List<List<Double>>? = null, val blendedBackgroundColors: List<Int>? = null, val textColorOpacities: List<Double>? = null)

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

Link copied to clipboard
@Serializable
data class NameValue(val name: String, val value: String)

A name/value pair.

Link copied to clipboard
@Serializable
data class NodeTreeSnapshot(val parentIndex: List<Int>? = null, val nodeType: List<Int>? = null, val shadowRootType: DOMSnapshot.RareStringData? = null, val nodeName: List<Int>? = null, val nodeValue: List<Int>? = null, val backendNodeId: List<Int>? = null, val attributes: List<List<Double>>? = null, val textValue: DOMSnapshot.RareStringData? = null, val inputValue: DOMSnapshot.RareStringData? = null, val inputChecked: DOMSnapshot.RareBooleanData? = null, val optionSelected: DOMSnapshot.RareBooleanData? = null, val contentDocumentIndex: DOMSnapshot.RareIntegerData? = null, val pseudoType: DOMSnapshot.RareStringData? = null, val pseudoIdentifier: DOMSnapshot.RareStringData? = null, val isClickable: DOMSnapshot.RareBooleanData? = null, val currentSourceURL: DOMSnapshot.RareStringData? = null, val originURL: DOMSnapshot.RareStringData? = null)

Table containing nodes.

Link copied to clipboard
@Serializable
data class RareBooleanData(val index: List<Int>)
Link copied to clipboard
@Serializable
data class RareIntegerData(val index: List<Int>, val value: List<Int>)
Link copied to clipboard
@Serializable
data class RareStringData(val index: List<Int>, val value: List<Int>)

Data that is only present on rare nodes.

Link copied to clipboard
@Serializable
data class TextBoxSnapshot(val layoutIndex: List<Int>, val bounds: List<List<Double>>, val start: List<Int>, val length: List<Int>)

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

Functions

Link copied to clipboard
suspend fun captureSnapshot(computedStyles: List<String>, includePaintOrder: Boolean? = null, includeDOMRects: Boolean? = null, includeBlendedBackgroundColors: Boolean? = null, includeTextColorOpacities: Boolean? = null): DOMSnapshot.CaptureSnapshotReturn

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.

Link copied to clipboard
suspend fun disable(mode: CommandMode = CommandMode.DEFAULT)

Disables DOM snapshot agent for the given page.

Link copied to clipboard
suspend fun enable(mode: CommandMode = CommandMode.DEFAULT)

Enables DOM snapshot agent for the given page.

Link copied to clipboard
suspend fun getSnapshot(computedStyleWhitelist: List<String>, includeEventListeners: Boolean? = null, includePaintOrder: Boolean? = null, includeUserAgentShadowTree: Boolean? = null): DOMSnapshot.GetSnapshotReturn

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.