Tungsten v0.1.0 Tungsten.CDP.DOMSnapshot View Source
This domain facilitates obtaining document snapshots with DOM, layout, and style information.
Link to this section Summary
Link to this section Types
cdp_array_of_strings_type()
View Source
cdp_array_of_strings_type() :: [cdp_string_index_type()]
cdp_array_of_strings_type() :: [cdp_string_index_type()]
Index of the string in the strings table.
cdp_computed_style_type()
View Source
cdp_computed_style_type() :: %{properties: [cdp_name_value_type()]}
cdp_computed_style_type() :: %{properties: [cdp_name_value_type()]}
A subset of the full ComputedStyle as defined by the request whitelist.
cdp_document_snapshot_type()
View Source
cdp_document_snapshot_type() :: %{
:document_url => cdp_string_index_type(),
:base_url => cdp_string_index_type(),
:content_language => cdp_string_index_type(),
:encoding_name => cdp_string_index_type(),
:public_id => cdp_string_index_type(),
:system_id => cdp_string_index_type(),
:frame_id => cdp_string_index_type(),
:nodes => cdp_node_tree_snapshot_type(),
:layout => cdp_layout_tree_snapshot_type(),
:text_boxes => cdp_text_box_snapshot_type(),
optional(:scroll_offset_x) => integer() | float(),
optional(:scroll_offset_y) => integer() | float()
}
cdp_document_snapshot_type() :: %{
:document_url => cdp_string_index_type(),
:base_url => cdp_string_index_type(),
:content_language => cdp_string_index_type(),
:encoding_name => cdp_string_index_type(),
:public_id => cdp_string_index_type(),
:system_id => cdp_string_index_type(),
:frame_id => cdp_string_index_type(),
:nodes => cdp_node_tree_snapshot_type(),
:layout => cdp_layout_tree_snapshot_type(),
:text_boxes => cdp_text_box_snapshot_type(),
optional(:scroll_offset_x) => integer() | float(),
optional(:scroll_offset_y) => integer() | float()
}
Document snapshot.
cdp_dom_node_type()
View Source
cdp_dom_node_type() :: %{
:node_type => integer(),
:node_name => String.t(),
:node_value => String.t(),
optional(:text_value) => String.t(),
optional(:input_value) => String.t(),
optional(:input_checked) => boolean(),
optional(:option_selected) => boolean(),
:backend_node_id => Tungsten.CDP.DOM.cdp_backend_node_id_type(),
optional(:child_node_indexes) => [integer()],
optional(:attributes) => [cdp_name_value_type()],
optional(:pseudo_element_indexes) => [integer()],
optional(:layout_node_index) => integer(),
optional(:document_url) => String.t(),
optional(:base_url) => String.t(),
optional(:content_language) => String.t(),
optional(:document_encoding) => String.t(),
optional(:public_id) => String.t(),
optional(:system_id) => String.t(),
optional(:frame_id) => Tungsten.CDP.Page.cdp_frame_id_type(),
optional(:content_document_index) => integer(),
optional(:pseudo_type) => Tungsten.CDP.DOM.cdp_pseudo_type_type(),
optional(:shadow_root_type) => Tungsten.CDP.DOM.cdp_shadow_root_type_type(),
optional(:is_clickable) => boolean(),
optional(:event_listeners) => [
Tungsten.CDP.DOMDebugger.cdp_event_listener_type()
],
optional(:current_source_url) => String.t(),
optional(:origin_url) => String.t(),
optional(:scroll_offset_x) => integer() | float(),
optional(:scroll_offset_y) => integer() | float()
}
cdp_dom_node_type() :: %{
:node_type => integer(),
:node_name => String.t(),
:node_value => String.t(),
optional(:text_value) => String.t(),
optional(:input_value) => String.t(),
optional(:input_checked) => boolean(),
optional(:option_selected) => boolean(),
:backend_node_id => Tungsten.CDP.DOM.cdp_backend_node_id_type(),
optional(:child_node_indexes) => [integer()],
optional(:attributes) => [cdp_name_value_type()],
optional(:pseudo_element_indexes) => [integer()],
optional(:layout_node_index) => integer(),
optional(:document_url) => String.t(),
optional(:base_url) => String.t(),
optional(:content_language) => String.t(),
optional(:document_encoding) => String.t(),
optional(:public_id) => String.t(),
optional(:system_id) => String.t(),
optional(:frame_id) => Tungsten.CDP.Page.cdp_frame_id_type(),
optional(:content_document_index) => integer(),
optional(:pseudo_type) => Tungsten.CDP.DOM.cdp_pseudo_type_type(),
optional(:shadow_root_type) => Tungsten.CDP.DOM.cdp_shadow_root_type_type(),
optional(:is_clickable) => boolean(),
optional(:event_listeners) => [
Tungsten.CDP.DOMDebugger.cdp_event_listener_type()
],
optional(:current_source_url) => String.t(),
optional(:origin_url) => String.t(),
optional(:scroll_offset_x) => integer() | float(),
optional(:scroll_offset_y) => integer() | float()
}
A Node in the DOM tree.
cdp_inline_text_box_type()
View Source
cdp_inline_text_box_type() :: %{
bounding_box: Tungsten.CDP.DOM.cdp_rect_type(),
start_character_index: integer(),
num_characters: integer()
}
cdp_inline_text_box_type() :: %{
bounding_box: Tungsten.CDP.DOM.cdp_rect_type(),
start_character_index: integer(),
num_characters: integer()
}
Details of post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.
cdp_layout_tree_node_type()
View Source
cdp_layout_tree_node_type() :: %{
:dom_node_index => integer(),
:bounding_box => Tungsten.CDP.DOM.cdp_rect_type(),
optional(:layout_text) => String.t(),
optional(:inline_text_nodes) => [cdp_inline_text_box_type()],
optional(:style_index) => integer(),
optional(:paint_order) => integer(),
optional(:is_stacking_context) => boolean()
}
cdp_layout_tree_node_type() :: %{
:dom_node_index => integer(),
:bounding_box => Tungsten.CDP.DOM.cdp_rect_type(),
optional(:layout_text) => String.t(),
optional(:inline_text_nodes) => [cdp_inline_text_box_type()],
optional(:style_index) => integer(),
optional(:paint_order) => integer(),
optional(:is_stacking_context) => boolean()
}
Details of an element in the DOM tree with a LayoutObject.
cdp_layout_tree_snapshot_type()
View Source
cdp_layout_tree_snapshot_type() :: %{
node_index: [integer()],
styles: [cdp_array_of_strings_type()],
bounds: [cdp_rectangle_type()],
text: [cdp_string_index_type()],
stacking_contexts: cdp_rare_boolean_data_type()
}
cdp_layout_tree_snapshot_type() :: %{
node_index: [integer()],
styles: [cdp_array_of_strings_type()],
bounds: [cdp_rectangle_type()],
text: [cdp_string_index_type()],
stacking_contexts: cdp_rare_boolean_data_type()
}
DOMSnapshot.LayoutTreeSnapshot
Details of an element in the DOM tree with a LayoutObject.
cdp_name_value_type() View Source
A name/value pair.
cdp_node_tree_snapshot_type()
View Source
cdp_node_tree_snapshot_type() :: %{
optional(:parent_index) => [integer()],
optional(:node_type) => [integer()],
optional(:node_name) => [cdp_string_index_type()],
optional(:node_value) => [cdp_string_index_type()],
optional(:backend_node_id) => [Tungsten.CDP.DOM.cdp_backend_node_id_type()],
optional(:attributes) => [cdp_array_of_strings_type()],
optional(:text_value) => cdp_rare_string_data_type(),
optional(:input_value) => cdp_rare_string_data_type(),
optional(:input_checked) => cdp_rare_boolean_data_type(),
optional(:option_selected) => cdp_rare_boolean_data_type(),
optional(:content_document_index) => cdp_rare_integer_data_type(),
optional(:pseudo_type) => cdp_rare_string_data_type(),
optional(:is_clickable) => cdp_rare_boolean_data_type(),
optional(:current_source_url) => cdp_rare_string_data_type(),
optional(:origin_url) => cdp_rare_string_data_type()
}
cdp_node_tree_snapshot_type() :: %{
optional(:parent_index) => [integer()],
optional(:node_type) => [integer()],
optional(:node_name) => [cdp_string_index_type()],
optional(:node_value) => [cdp_string_index_type()],
optional(:backend_node_id) => [Tungsten.CDP.DOM.cdp_backend_node_id_type()],
optional(:attributes) => [cdp_array_of_strings_type()],
optional(:text_value) => cdp_rare_string_data_type(),
optional(:input_value) => cdp_rare_string_data_type(),
optional(:input_checked) => cdp_rare_boolean_data_type(),
optional(:option_selected) => cdp_rare_boolean_data_type(),
optional(:content_document_index) => cdp_rare_integer_data_type(),
optional(:pseudo_type) => cdp_rare_string_data_type(),
optional(:is_clickable) => cdp_rare_boolean_data_type(),
optional(:current_source_url) => cdp_rare_string_data_type(),
optional(:origin_url) => cdp_rare_string_data_type()
}
Table containing nodes.
cdp_rare_boolean_data_type()
View Source
cdp_rare_boolean_data_type() :: %{index: [integer()]}
cdp_rare_boolean_data_type() :: %{index: [integer()]}
This type has no documentation
cdp_rare_integer_data_type() View Source
This type has no documentation
cdp_rare_string_data_type()
View Source
cdp_rare_string_data_type() :: %{
index: [integer()],
value: [cdp_string_index_type()]
}
cdp_rare_string_data_type() :: %{
index: [integer()],
value: [cdp_string_index_type()]
}
Data that is only present on rare nodes.
cdp_rectangle_type() View Source
This type has no documentation
cdp_string_index_type()
View Source
cdp_string_index_type() :: integer()
cdp_string_index_type() :: integer()
Index of the string in the strings table.
cdp_text_box_snapshot_type()
View Source
cdp_text_box_snapshot_type() :: %{
layout_index: [integer()],
bounds: [cdp_rectangle_type()],
start: [integer()],
length: [integer()]
}
cdp_text_box_snapshot_type() :: %{
layout_index: [integer()],
bounds: [cdp_rectangle_type()],
start: [integer()],
length: [integer()]
}
Details of post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.
Link to this section Functions
capture_snapshot(session, parameters, options \\ [])
View Source
capture_snapshot(
GenServer.server(),
%{computed_styles: [String.t()]},
Tungsten.Connection.exec_options()
) ::
{:ok, %{documents: [cdp_document_snapshot_type()], strings: [String.t()]}}
| {:error, term()}
capture_snapshot( GenServer.server(), %{computed_styles: [String.t()]}, Tungsten.Connection.exec_options() ) :: {:ok, %{documents: [cdp_document_snapshot_type()], strings: [String.t()]}} | {:error, term()}
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.
disable(session, parameters \\ %{}, options \\ [])
View Source
disable(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
{:ok, map()} | {:error, term()}
disable(GenServer.server(), map(), Tungsten.Connection.exec_options()) :: {:ok, map()} | {:error, term()}
Disables DOM snapshot agent for the given page.
enable(session, parameters \\ %{}, options \\ [])
View Source
enable(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
{:ok, map()} | {:error, term()}
enable(GenServer.server(), map(), Tungsten.Connection.exec_options()) :: {:ok, map()} | {:error, term()}
Enables DOM snapshot agent for the given page.
get_snapshot(session, parameters, options \\ [])
View Source
get_snapshot(
GenServer.server(),
%{
:computed_style_whitelist => [String.t()],
optional(:include_event_listeners) => boolean(),
optional(:include_paint_order) => boolean(),
optional(:include_user_agent_shadow_tree) => boolean()
},
Tungsten.Connection.exec_options()
) ::
{:ok,
%{
dom_nodes: [cdp_dom_node_type()],
layout_tree_nodes: [cdp_layout_tree_node_type()],
computed_styles: [cdp_computed_style_type()]
}}
| {:error, term()}
get_snapshot( GenServer.server(), %{ :computed_style_whitelist => [String.t()], optional(:include_event_listeners) => boolean(), optional(:include_paint_order) => boolean(), optional(:include_user_agent_shadow_tree) => boolean() }, Tungsten.Connection.exec_options() ) :: {:ok, %{ dom_nodes: [cdp_dom_node_type()], layout_tree_nodes: [cdp_layout_tree_node_type()], computed_styles: [cdp_computed_style_type()] }} | {:error, term()}
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.