CDPotion.Domain.DOMSnapshot (cdpotion v0.1.4)
Summary
Types
Index of the string in the strings table.
A subset of the full ComputedStyle as defined by the request whitelist.
Document snapshot.
A Node in the DOM tree.
Details of post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.
Details of an element in the DOM tree with a LayoutObject.
Table of details of an element in the DOM tree with a LayoutObject.
A name/value pair.
Table containing nodes.
description not provided :(
description not provided :(
Data that is only present on rare nodes.
description not provided :(
Index of the string in the strings table.
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
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.
Disables DOM snapshot agent for the given page.
Enables DOM snapshot agent for the given page.
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.
Types
array_of_strings()
@type array_of_strings() :: [string_index()]
Index of the string in the strings table.
computed_style()
@type computed_style() :: %{properties: [name_value()]}
A subset of the full ComputedStyle as defined by the request whitelist.
document_snapshot()
@type document_snapshot() :: %{ baseURL: string_index(), contentHeight: number() | nil, contentLanguage: string_index(), contentWidth: number() | nil, documentURL: string_index(), encodingName: string_index(), frameId: string_index(), layout: layout_tree_snapshot(), nodes: node_tree_snapshot(), publicId: string_index(), scrollOffsetX: number() | nil, scrollOffsetY: number() | nil, systemId: string_index(), textBoxes: text_box_snapshot(), title: string_index() }
Document snapshot.
dom_node()
@type dom_node() :: %{ attributes: [name_value()] | nil, backendNodeId: CDPotion.Domain.DOM.backend_node_id(), baseURL: String.t() | nil, childNodeIndexes: [integer()] | nil, contentDocumentIndex: integer() | nil, contentLanguage: String.t() | nil, currentSourceURL: String.t() | nil, documentEncoding: String.t() | nil, documentURL: String.t() | nil, eventListeners: [CDPotion.Domain.DOMDebugger.event_listener()] | nil, frameId: CDPotion.Domain.Page.frame_id() | nil, inputChecked: boolean() | nil, inputValue: String.t() | nil, isClickable: boolean() | nil, layoutNodeIndex: integer() | nil, nodeName: String.t(), nodeType: integer(), nodeValue: String.t(), optionSelected: boolean() | nil, originURL: String.t() | nil, pseudoElementIndexes: [integer()] | nil, pseudoType: CDPotion.Domain.DOM.pseudo_type() | nil, publicId: String.t() | nil, scrollOffsetX: number() | nil, scrollOffsetY: number() | nil, shadowRootType: CDPotion.Domain.DOM.shadow_root_type() | nil, systemId: String.t() | nil, textValue: String.t() | nil }
A Node in the DOM tree.
inline_text_box()
@type inline_text_box() :: %{ boundingBox: CDPotion.Domain.DOM.rect(), numCharacters: integer(), startCharacterIndex: integer() }
Details of post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.
layout_tree_node()
@type layout_tree_node() :: %{ boundingBox: CDPotion.Domain.DOM.rect(), domNodeIndex: integer(), inlineTextNodes: [inline_text_box()] | nil, isStackingContext: boolean() | nil, layoutText: String.t() | nil, paintOrder: integer() | nil, styleIndex: integer() | nil }
Details of an element in the DOM tree with a LayoutObject.
layout_tree_snapshot()
@type layout_tree_snapshot() :: %{ blendedBackgroundColors: [string_index()] | nil, bounds: [rectangle()], clientRects: [rectangle()] | nil, nodeIndex: [integer()], offsetRects: [rectangle()] | nil, paintOrders: [integer()] | nil, scrollRects: [rectangle()] | nil, stackingContexts: rare_boolean_data(), styles: [array_of_strings()], text: [string_index()], textColorOpacities: [number()] | nil }
Table of details of an element in the DOM tree with a LayoutObject.
name_value()
A name/value pair.
node_tree_snapshot()
@type node_tree_snapshot() :: %{ attributes: [array_of_strings()] | nil, backendNodeId: [CDPotion.Domain.DOM.backend_node_id()] | nil, contentDocumentIndex: rare_integer_data() | nil, currentSourceURL: rare_string_data() | nil, inputChecked: rare_boolean_data() | nil, inputValue: rare_string_data() | nil, isClickable: rare_boolean_data() | nil, nodeName: [string_index()] | nil, nodeType: [integer()] | nil, nodeValue: [string_index()] | nil, optionSelected: rare_boolean_data() | nil, originURL: rare_string_data() | nil, parentIndex: [integer()] | nil, pseudoIdentifier: rare_string_data() | nil, pseudoType: rare_string_data() | nil, shadowRootType: rare_string_data() | nil, textValue: rare_string_data() | nil }
Table containing nodes.
rare_boolean_data()
@type rare_boolean_data() :: %{index: [integer()]}
description not provided :(
rare_integer_data()
description not provided :(
rare_string_data()
@type rare_string_data() :: %{index: [integer()], value: [string_index()]}
Data that is only present on rare nodes.
rectangle()
@type rectangle() :: [number()]
description not provided :(
string_index()
@type string_index() :: integer()
Index of the string in the strings table.
text_box_snapshot()
@type text_box_snapshot() :: %{ bounds: [rectangle()], layoutIndex: [integer()], length: [integer()], start: [integer()] }
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
capture_snapshot(computed_styles, include_paint_order \\ nil, include_dom_rects \\ nil, include_blended_background_colors \\ nil, include_text_color_opacities \\ nil)
@spec capture_snapshot([String.t()], boolean(), boolean(), boolean(), boolean()) :: {String.t(), map()}
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:
- (Required)
computed_styles
: Whitelist of computed styles to return. - (Optional)
include_paint_order
: Whether to include layout object paint orders into the snapshot. - (Optional)
include_dom_rects
: Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot - (Optional)
include_blended_background_colors
: 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. - (Optional)
include_text_color_opacities
: 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.
disable()
Disables DOM snapshot agent for the given page.
enable()
Enables DOM snapshot agent for the given page.
get_snapshot(computed_style_whitelist, include_event_listeners \\ nil, include_paint_order \\ nil, include_user_agent_shadow_tree \\ nil)
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:
- (Required)
computed_style_whitelist
: Whitelist of computed styles to return. - (Optional)
include_event_listeners
: Whether or not to retrieve details of DOM listeners (default false). - (Optional)
include_paint_order
: Whether to determine and include the paint order index of LayoutTreeNodes (default false). - (Optional)
include_user_agent_shadow_tree
: Whether to include UA shadow tree in the snapshot (default false).