glendam/protocol/dom

This module is generated from the Chrome DevTools Protocol schema.

Do not edit this file manually. Generator: dev/codegen/generate_bindings.gleam Regenerate with:

gleam run -m codegen/generate_bindings

Protocol version: 1.3

DOM Domain

This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an id. This id can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client’s responsibility to collect information about the nodes that were sent to the client. Note that iframe owner elements will return corresponding document elements as their child nodes.

📖 View this domain on the DevTools Protocol API Docs

Types

Backend node with a friendly name.

pub type BackendNode {
  BackendNode(
    node_type: Int,
    node_name: String,
    backend_node_id: BackendNodeId,
  )
}

Constructors

  • BackendNode(
      node_type: Int,
      node_name: String,
      backend_node_id: BackendNodeId,
    )

    Represents the BackendNode protocol value.

    Arguments

    node_type

    Node’s nodeType.

    node_name

    Node’s nodeName.

Unique DOM node identifier used to reference a node that may not have been pushed to the front-end.

pub type BackendNodeId {
  BackendNodeId(Int)
}

Constructors

  • BackendNodeId(Int)

    Represents the BackendNodeId protocol value.

Box model.

pub type BoxModel {
  BoxModel(
    content: Quad,
    padding: Quad,
    border: Quad,
    margin: Quad,
    width: Int,
    height: Int,
    shape_outside: option.Option(ShapeOutsideInfo),
  )
}

Constructors

  • BoxModel(
      content: Quad,
      padding: Quad,
      border: Quad,
      margin: Quad,
      width: Int,
      height: Int,
      shape_outside: option.Option(ShapeOutsideInfo),
    )

    Represents the BoxModel protocol value.

    Arguments

    content

    Content box

    padding

    Padding box

    border

    Border box

    margin

    Margin box

    width

    Node width

    height

    Node height

    shape_outside

    Shape outside coordinates

Represents the Chrome DevTools Protocol CSSComputedStyleProperty value.

pub type CSSComputedStyleProperty {
  CSSComputedStyleProperty(name: String, value: String)
}

Constructors

  • CSSComputedStyleProperty(name: String, value: String)

    Represents the CSSComputedStyleProperty protocol value.

    Arguments

    name

    Computed style property name.

    value

    Computed style property value.

Document compatibility mode.

pub type CompatibilityMode {
  CompatibilityModeQuirksMode
  CompatibilityModeLimitedQuirksMode
  CompatibilityModeNoQuirksMode
}

Constructors

  • CompatibilityModeQuirksMode

    Represents the QuirksMode protocol value.

  • CompatibilityModeLimitedQuirksMode

    Represents the LimitedQuirksMode protocol value.

  • CompatibilityModeNoQuirksMode

    Represents the NoQuirksMode protocol value.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command describe_node

pub type DescribeNodeResponse {
  DescribeNodeResponse(node: Node)
}

Constructors

  • DescribeNodeResponse(node: Node)

    Represents the DescribeNodeResponse protocol value.

    Arguments

    node

    Node description.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_attributes

pub type GetAttributesResponse {
  GetAttributesResponse(attributes: List(String))
}

Constructors

  • GetAttributesResponse(attributes: List(String))

    Represents the GetAttributesResponse protocol value.

    Arguments

    attributes

    An interleaved array of node attribute names and values.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_box_model

pub type GetBoxModelResponse {
  GetBoxModelResponse(model: BoxModel)
}

Constructors

  • GetBoxModelResponse(model: BoxModel)

    Represents the GetBoxModelResponse protocol value.

    Arguments

    model

    Box model for the node.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_document

pub type GetDocumentResponse {
  GetDocumentResponse(root: Node)
}

Constructors

  • GetDocumentResponse(root: Node)

    Represents the GetDocumentResponse protocol value.

    Arguments

    root

    Resulting node.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_node_for_location

pub type GetNodeForLocationResponse {
  GetNodeForLocationResponse(
    backend_node_id: BackendNodeId,
    frame_id: String,
    node_id: option.Option(NodeId),
  )
}

Constructors

  • GetNodeForLocationResponse(
      backend_node_id: BackendNodeId,
      frame_id: String,
      node_id: option.Option(NodeId),
    )

    Represents the GetNodeForLocationResponse protocol value.

    Arguments

    backend_node_id

    Resulting node.

    frame_id

    Frame this node belongs to.

    node_id

    Id of the node at given coordinates, only when enabled and requested document.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_outer_html

pub type GetOuterHtmlResponse {
  GetOuterHtmlResponse(outer_html: String)
}

Constructors

  • GetOuterHtmlResponse(outer_html: String)

    Represents the GetOuterHtmlResponse protocol value.

    Arguments

    outer_html

    Outer HTML markup.

ContainerSelector logical axes

pub type LogicalAxes {
  LogicalAxesInline
  LogicalAxesBlock
  LogicalAxesBoth
}

Constructors

  • LogicalAxesInline

    Represents the Inline protocol value.

  • LogicalAxesBlock

    Represents the Block protocol value.

  • LogicalAxesBoth

    Represents the Both protocol value.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command move_to

pub type MoveToResponse {
  MoveToResponse(node_id: NodeId)
}

Constructors

  • MoveToResponse(node_id: NodeId)

    Represents the MoveToResponse protocol value.

    Arguments

    node_id

    New id of the moved node.

DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type.

pub type Node {
  Node(
    node_id: NodeId,
    parent_id: option.Option(NodeId),
    backend_node_id: BackendNodeId,
    node_type: Int,
    node_name: String,
    local_name: String,
    node_value: String,
    child_node_count: option.Option(Int),
    children: option.Option(List(Node)),
    attributes: option.Option(List(String)),
    document_url: option.Option(String),
    base_url: option.Option(String),
    public_id: option.Option(String),
    system_id: option.Option(String),
    internal_subset: option.Option(String),
    xml_version: option.Option(String),
    name: option.Option(String),
    value: option.Option(String),
    pseudo_type: option.Option(PseudoType),
    pseudo_identifier: option.Option(String),
    shadow_root_type: option.Option(ShadowRootType),
    frame_id: option.Option(String),
    content_document: option.Option(Node),
    shadow_roots: option.Option(List(Node)),
    template_content: option.Option(Node),
    pseudo_elements: option.Option(List(Node)),
    distributed_nodes: option.Option(List(BackendNode)),
    is_svg: option.Option(protocol_support.BooleanSetting),
    compatibility_mode: option.Option(CompatibilityMode),
    assigned_slot: option.Option(BackendNode),
  )
}

Constructors

  • Node(
      node_id: NodeId,
      parent_id: option.Option(NodeId),
      backend_node_id: BackendNodeId,
      node_type: Int,
      node_name: String,
      local_name: String,
      node_value: String,
      child_node_count: option.Option(Int),
      children: option.Option(List(Node)),
      attributes: option.Option(List(String)),
      document_url: option.Option(String),
      base_url: option.Option(String),
      public_id: option.Option(String),
      system_id: option.Option(String),
      internal_subset: option.Option(String),
      xml_version: option.Option(String),
      name: option.Option(String),
      value: option.Option(String),
      pseudo_type: option.Option(PseudoType),
      pseudo_identifier: option.Option(String),
      shadow_root_type: option.Option(ShadowRootType),
      frame_id: option.Option(String),
      content_document: option.Option(Node),
      shadow_roots: option.Option(List(Node)),
      template_content: option.Option(Node),
      pseudo_elements: option.Option(List(Node)),
      distributed_nodes: option.Option(List(BackendNode)),
      is_svg: option.Option(protocol_support.BooleanSetting),
      compatibility_mode: option.Option(CompatibilityMode),
      assigned_slot: option.Option(BackendNode),
    )

    Represents the Node protocol value.

    Arguments

    node_id

    Node identifier that is passed into the rest of the DOM messages as the nodeId. Backend will only push node with given id once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client.

    parent_id

    The id of the parent node if any.

    backend_node_id

    The BackendNodeId for this node.

    node_type

    Node’s nodeType.

    node_name

    Node’s nodeName.

    local_name

    Node’s localName.

    node_value

    Node’s nodeValue.

    child_node_count

    Child count for Container nodes.

    children

    Child nodes of this node when requested with children.

    attributes

    Attributes of the Element node in the form of flat array [name1, value1, name2, value2].

    document_url

    Document URL that Document or FrameOwner node points to.

    base_url

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

    public_id

    DocumentType’s publicId.

    system_id

    DocumentType’s systemId.

    internal_subset

    DocumentType’s internalSubset.

    xml_version

    Document’s XML version in case of XML documents.

    name

    Attr’s name.

    value

    Attr’s value.

    pseudo_type

    Pseudo element type for this node.

    pseudo_identifier

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

    shadow_root_type

    Shadow root type.

    frame_id

    Frame ID for frame owner elements.

    content_document

    Content document for frame owner elements.

    shadow_roots

    Shadow root list for given element host.

    template_content

    Content document fragment for template elements.

    pseudo_elements

    Pseudo elements associated with this node.

    distributed_nodes

    Distributed nodes for given insertion point.

    is_svg

    Whether the node is SVG.

Unique DOM node identifier.

pub type NodeId {
  NodeId(Int)
}

Constructors

  • NodeId(Int)

    Represents the NodeId protocol value.

ContainerSelector physical axes

pub type PhysicalAxes {
  PhysicalAxesHorizontal
  PhysicalAxesVertical
  PhysicalAxesBoth
}

Constructors

  • PhysicalAxesHorizontal

    Represents the Horizontal protocol value.

  • PhysicalAxesVertical

    Represents the Vertical protocol value.

  • PhysicalAxesBoth

    Represents the Both protocol value.

Pseudo element type.

pub type PseudoType {
  PseudoTypeFirstLine
  PseudoTypeFirstLetter
  PseudoTypeBefore
  PseudoTypeAfter
  PseudoTypeMarker
  PseudoTypeBackdrop
  PseudoTypeSelection
  PseudoTypeTargetText
  PseudoTypeSpellingError
  PseudoTypeGrammarError
  PseudoTypeHighlight
  PseudoTypeFirstLineInherited
  PseudoTypeScrollMarker
  PseudoTypeScrollMarkers
  PseudoTypeScrollbar
  PseudoTypeScrollbarThumb
  PseudoTypeScrollbarButton
  PseudoTypeScrollbarTrack
  PseudoTypeScrollbarTrackPiece
  PseudoTypeScrollbarCorner
  PseudoTypeResizer
  PseudoTypeInputListButton
  PseudoTypeViewTransition
  PseudoTypeViewTransitionGroup
  PseudoTypeViewTransitionImagePair
  PseudoTypeViewTransitionOld
  PseudoTypeViewTransitionNew
}

Constructors

  • PseudoTypeFirstLine

    Represents the first-line protocol value.

  • PseudoTypeFirstLetter

    Represents the first-letter protocol value.

  • PseudoTypeBefore

    Represents the before protocol value.

  • PseudoTypeAfter

    Represents the after protocol value.

  • PseudoTypeMarker

    Represents the marker protocol value.

  • PseudoTypeBackdrop

    Represents the backdrop protocol value.

  • PseudoTypeSelection

    Represents the selection protocol value.

  • PseudoTypeTargetText

    Represents the target-text protocol value.

  • PseudoTypeSpellingError

    Represents the spelling-error protocol value.

  • PseudoTypeGrammarError

    Represents the grammar-error protocol value.

  • PseudoTypeHighlight

    Represents the highlight protocol value.

  • PseudoTypeFirstLineInherited

    Represents the first-line-inherited protocol value.

  • PseudoTypeScrollMarker

    Represents the scroll-marker protocol value.

  • PseudoTypeScrollMarkers

    Represents the scroll-markers protocol value.

  • PseudoTypeScrollbar

    Represents the scrollbar protocol value.

  • PseudoTypeScrollbarThumb

    Represents the scrollbar-thumb protocol value.

  • PseudoTypeScrollbarButton

    Represents the scrollbar-button protocol value.

  • PseudoTypeScrollbarTrack

    Represents the scrollbar-track protocol value.

  • PseudoTypeScrollbarTrackPiece

    Represents the scrollbar-track-piece protocol value.

  • PseudoTypeScrollbarCorner

    Represents the scrollbar-corner protocol value.

  • PseudoTypeResizer

    Represents the resizer protocol value.

  • PseudoTypeInputListButton

    Represents the input-list-button protocol value.

  • PseudoTypeViewTransition

    Represents the view-transition protocol value.

  • PseudoTypeViewTransitionGroup

    Represents the view-transition-group protocol value.

  • PseudoTypeViewTransitionImagePair

    Represents the view-transition-image-pair protocol value.

  • PseudoTypeViewTransitionOld

    Represents the view-transition-old protocol value.

  • PseudoTypeViewTransitionNew

    Represents the view-transition-new protocol value.

An array of quad vertices, x immediately followed by y for each point, points clock-wise.

pub type Quad {
  Quad(List(Float))
}

Constructors

  • Quad(List(Float))

    Represents the Quad protocol value.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command query_selector_all

pub type QuerySelectorAllResponse {
  QuerySelectorAllResponse(node_ids: List(NodeId))
}

Constructors

  • QuerySelectorAllResponse(node_ids: List(NodeId))

    Represents the QuerySelectorAllResponse protocol value.

    Arguments

    node_ids

    Query selector result.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command query_selector

pub type QuerySelectorResponse {
  QuerySelectorResponse(node_id: NodeId)
}

Constructors

  • QuerySelectorResponse(node_id: NodeId)

    Represents the QuerySelectorResponse protocol value.

    Arguments

    node_id

    Query selector result.

A structure holding an RGBA color.

pub type RGBA {
  RGBA(r: Int, g: Int, b: Int, a: option.Option(Float))
}

Constructors

  • RGBA(r: Int, g: Int, b: Int, a: option.Option(Float))

    Represents the RGBA protocol value.

    Arguments

    r

    The red component, in the [0-255] range.

    g

    The green component, in the [0-255] range.

    b

    The blue component, in the [0-255] range.

    a

    The alpha component, in the [0-1] range (default: 1).

Rectangle.

pub type Rect {
  Rect(x: Float, y: Float, width: Float, height: Float)
}

Constructors

  • Rect(x: Float, y: Float, width: Float, height: Float)

    Represents the Rect protocol value.

    Arguments

    x

    X coordinate

    y

    Y coordinate

    width

    Rectangle width

    height

    Rectangle height

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command request_node

pub type RequestNodeResponse {
  RequestNodeResponse(node_id: NodeId)
}

Constructors

  • RequestNodeResponse(node_id: NodeId)

    Represents the RequestNodeResponse protocol value.

    Arguments

    node_id

    Node id for given object.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command resolve_node

pub type ResolveNodeResponse {
  ResolveNodeResponse(object: runtime.RemoteObject)
}

Constructors

  • ResolveNodeResponse(object: runtime.RemoteObject)

    Represents the ResolveNodeResponse protocol value.

    Arguments

    object

    JavaScript object wrapper for given node.

Physical scroll orientation

pub type ScrollOrientation {
  ScrollOrientationHorizontal
  ScrollOrientationVertical
}

Constructors

  • ScrollOrientationHorizontal

    Represents the horizontal protocol value.

  • ScrollOrientationVertical

    Represents the vertical protocol value.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command set_node_name

pub type SetNodeNameResponse {
  SetNodeNameResponse(node_id: NodeId)
}

Constructors

  • SetNodeNameResponse(node_id: NodeId)

    Represents the SetNodeNameResponse protocol value.

    Arguments

    node_id

    New node’s id.

Shadow root type.

pub type ShadowRootType {
  ShadowRootTypeUserAgent
  ShadowRootTypeOpen
  ShadowRootTypeClosed
}

Constructors

  • ShadowRootTypeUserAgent

    Represents the user-agent protocol value.

  • ShadowRootTypeOpen

    Represents the open protocol value.

  • ShadowRootTypeClosed

    Represents the closed protocol value.

CSS Shape Outside details.

pub type ShapeOutsideInfo {
  ShapeOutsideInfo(
    bounds: Quad,
    shape: List(dynamic.Dynamic),
    margin_shape: List(dynamic.Dynamic),
  )
}

Constructors

  • ShapeOutsideInfo(
      bounds: Quad,
      shape: List(dynamic.Dynamic),
      margin_shape: List(dynamic.Dynamic),
    )

    Represents the ShapeOutsideInfo protocol value.

    Arguments

    bounds

    Shape bounds

    shape

    Shape coordinate details

    margin_shape

    Margin shape bounds

Values

pub fn describe_node(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: option.Option(NodeId),
  backend_node_id backend_node_id: option.Option(BackendNodeId),
  object_id object_id: option.Option(runtime.RemoteObjectId),
  depth depth: option.Option(Int),
  pierce pierce: option.Option(protocol_support.BooleanSetting),
) -> Result(DescribeNodeResponse, chrome.RequestError)

Describes node given its id, does not require domain to be enabled. Does not start tracking any objects, can be used for automation.

Parameters:

  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.
  • depth : The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
  • pierce : Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).

Returns:

  • node : Node description.
pub fn disable(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
) -> Result(dynamic.Dynamic, chrome.RequestError)

Disables DOM agent for the given page.

pub fn enable(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
) -> Result(dynamic.Dynamic, chrome.RequestError)

Enables DOM agent for the given page.

Parameters:

Returns:

pub fn focus(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: option.Option(NodeId),
  backend_node_id backend_node_id: option.Option(BackendNodeId),
  object_id object_id: option.Option(runtime.RemoteObjectId),
) -> Result(dynamic.Dynamic, chrome.RequestError)

Focuses the given element.

Parameters:

  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.

Returns:

pub fn get_attributes(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
) -> Result(GetAttributesResponse, chrome.RequestError)

Returns attributes for the specified node.

Parameters:

  • node_id : Id of the node to retrieve attributes for.

Returns:

  • attributes : An interleaved array of node attribute names and values.
pub fn get_box_model(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: option.Option(NodeId),
  backend_node_id backend_node_id: option.Option(BackendNodeId),
  object_id object_id: option.Option(runtime.RemoteObjectId),
) -> Result(GetBoxModelResponse, chrome.RequestError)

Returns boxes for the given node.

Parameters:

  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.

Returns:

  • model : Box model for the node.
pub fn get_document(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  depth depth: option.Option(Int),
  pierce pierce: option.Option(protocol_support.BooleanSetting),
) -> Result(GetDocumentResponse, chrome.RequestError)

Returns the root DOM node (and optionally the subtree) to the caller. Implicitly enables the DOM domain events for the current target.

Parameters:

  • depth : The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
  • pierce : Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).

Returns:

  • root : Resulting node.
pub fn get_node_for_location(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  x x: Int,
  y y: Int,
  include_user_agent_shadow_dom include_user_agent_shadow_dom: option.Option(
    protocol_support.BooleanSetting,
  ),
  ignore_pointer_events_none ignore_pointer_events_none: option.Option(
    protocol_support.BooleanSetting,
  ),
) -> Result(GetNodeForLocationResponse, chrome.RequestError)

Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is either returned or not.

Parameters:

  • x : X coordinate.
  • y : Y coordinate.
  • include_user_agent_shadow_dom : False to skip to the nearest non-UA shadow root ancestor (default: false).
  • ignore_pointer_events_none : Whether to ignore pointer-events: none on elements and hit test them.

Returns:

  • backend_node_id : Resulting node.
  • frame_id : Frame this node belongs to.
  • node_id : Id of the node at given coordinates, only when enabled and requested document.
pub fn get_outer_html(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: option.Option(NodeId),
  backend_node_id backend_node_id: option.Option(BackendNodeId),
  object_id object_id: option.Option(runtime.RemoteObjectId),
) -> Result(GetOuterHtmlResponse, chrome.RequestError)

Returns node’s HTML markup.

Parameters:

  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.

Returns:

  • outer_html : Outer HTML markup.
pub fn hide_highlight(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
) -> Result(dynamic.Dynamic, chrome.RequestError)

Hides any highlight.

pub fn highlight_node(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
) -> Result(dynamic.Dynamic, chrome.RequestError)

Highlights DOM node.

pub fn highlight_rect(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
) -> Result(dynamic.Dynamic, chrome.RequestError)

Highlights given rectangle.

pub fn move_to(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
  target_node_id target_node_id: NodeId,
  insert_before_node_id insert_before_node_id: option.Option(
    NodeId,
  ),
) -> Result(MoveToResponse, chrome.RequestError)

Moves node into the new container, places it before the given anchor.

Parameters:

  • node_id : Id of the node to move.
  • target_node_id : Id of the element to drop the moved node into.
  • insert_before_node_id : Drop node before this one (if absent, the moved node becomes the last child of targetNodeId).

Returns:

  • node_id : New id of the moved node.
pub fn query_selector(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
  selector selector: String,
) -> Result(QuerySelectorResponse, chrome.RequestError)

Executes querySelector on a given node.

Parameters:

  • node_id : Id of the node to query upon.
  • selector : Selector string.

Returns:

  • node_id : Query selector result.
pub fn query_selector_all(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
  selector selector: String,
) -> Result(QuerySelectorAllResponse, chrome.RequestError)

Executes querySelectorAll on a given node.

Parameters:

  • node_id : Id of the node to query upon.
  • selector : Selector string.

Returns:

  • node_ids : Query selector result.
pub fn remove_attribute(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
  name name: String,
) -> Result(dynamic.Dynamic, chrome.RequestError)

Removes attribute with given name from an element with given id.

Parameters:

  • node_id : Id of the element to remove attribute from.
  • name : Name of the attribute to remove.

Returns:

pub fn remove_node(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
) -> Result(dynamic.Dynamic, chrome.RequestError)

Removes node with given id.

Parameters:

  • node_id : Id of the node to remove.

Returns:

pub fn request_child_nodes(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
  depth depth: option.Option(Int),
  pierce pierce: option.Option(protocol_support.BooleanSetting),
) -> Result(dynamic.Dynamic, chrome.RequestError)

Requests that children of the node with given id are returned to the caller in form of setChildNodes events where not only immediate children are retrieved, but all children down to the specified depth.

Parameters:

  • node_id : Id of the node to get children for.
  • depth : The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
  • pierce : Whether or not iframes and shadow roots should be traversed when returning the sub-tree (default is false).

Returns:

pub fn request_node(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  object_id object_id: runtime.RemoteObjectId,
) -> Result(RequestNodeResponse, chrome.RequestError)

Requests that the node is sent to the caller given the JavaScript node object reference. All nodes that form the path from the node to the root are also sent to the client as a series of setChildNodes notifications.

Parameters:

  • object_id : JavaScript object id to convert into node.

Returns:

  • node_id : Node id for given object.
pub fn resolve_node(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: option.Option(NodeId),
  backend_node_id backend_node_id: option.Option(BackendNodeId),
  object_group object_group: option.Option(String),
  execution_context_id execution_context_id: option.Option(
    runtime.ExecutionContextId,
  ),
) -> Result(ResolveNodeResponse, chrome.RequestError)

Resolves the JavaScript node object for a given NodeId or BackendNodeId.

Parameters:

  • node_id : Id of the node to resolve.
  • backend_node_id : Backend identifier of the node to resolve.
  • object_group : Symbolic group name that can be used to release multiple objects.
  • execution_context_id : Execution context in which to resolve the node.

Returns:

  • object : JavaScript object wrapper for given node.
pub fn scroll_into_view_if_needed(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: option.Option(NodeId),
  backend_node_id backend_node_id: option.Option(BackendNodeId),
  object_id object_id: option.Option(runtime.RemoteObjectId),
  rect rect: option.Option(Rect),
) -> Result(dynamic.Dynamic, chrome.RequestError)

Scrolls the specified rect of the given node into view if not already visible. Note: exactly one between nodeId, backendNodeId and objectId should be passed to identify the node.

Parameters:

  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.
  • rect : The rect to be scrolled into view, relative to the node’s border box, in CSS pixels. When omitted, center of the node will be used, similar to Element.scrollIntoView.

Returns:

pub fn set_attribute_value(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
  name name: String,
  value value: String,
) -> Result(dynamic.Dynamic, chrome.RequestError)

Sets attribute for an element with given id.

Parameters:

  • node_id : Id of the element to set attribute for.
  • name : Attribute name.
  • value : Attribute value.

Returns:

pub fn set_attributes_as_text(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
  text text: String,
  name name: option.Option(String),
) -> Result(dynamic.Dynamic, chrome.RequestError)

Sets attributes on element with given id. This method is useful when user edits some existing attribute value and types in several attribute name/value pairs.

Parameters:

  • node_id : Id of the element to set attributes for.
  • text : Text with a number of attributes. Will parse this text using HTML parser.
  • name : Attribute name to replace with new attributes derived from text in case text parsed successfully.

Returns:

pub fn set_file_input_files(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  files files: List(String),
  node_id node_id: option.Option(NodeId),
  backend_node_id backend_node_id: option.Option(BackendNodeId),
  object_id object_id: option.Option(runtime.RemoteObjectId),
) -> Result(dynamic.Dynamic, chrome.RequestError)

Sets files for the given file input element.

Parameters:

  • files : Array of file paths to set.
  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.

Returns:

pub fn set_node_name(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
  name name: String,
) -> Result(SetNodeNameResponse, chrome.RequestError)

Sets node name for a node with given id.

Parameters:

  • node_id : Id of the node to set name for.
  • name : New node’s name.

Returns:

  • node_id : New node’s id.
pub fn set_node_value(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
  value value: String,
) -> Result(dynamic.Dynamic, chrome.RequestError)

Sets node value for a node with given id.

Parameters:

  • node_id : Id of the node to set value for.
  • value : New node’s value.

Returns:

pub fn set_outer_html(
  callback callback__: fn(String, option.Option(json.Json)) -> Result(
    dynamic.Dynamic,
    chrome.RequestError,
  ),
  node_id node_id: NodeId,
  outer_html outer_html: String,
) -> Result(dynamic.Dynamic, chrome.RequestError)

Sets node HTML markup, returns new node id.

Parameters:

  • node_id : Id of the node to set markup for.
  • outer_html : Outer HTML markup to set.

Returns:

Search Document