CDPotion.Domain.Accessibility (cdpotion v0.1.4)

Summary

Types

A node in the accessibility tree.

Unique accessibility node identifier.

description not provided :(

Values of AXProperty name

description not provided :(

A single computed AX property.

Enum of possible native property sources (as a subtype of a particular AXValueSourceType).

A single source for a computed AX property.

Enum of possible property sources.

Enum of possible property types.

Functions

Disables the accessibility domain.

Enables the accessibility domain which causes AXNodeIds to remain consistent between method calls. This turns on accessibility for the page, which can impact performance until accessibility is disabled.

Fetches a node and all ancestors up to and including the root. Requires enable() to have been called previously.

Fetches a particular accessibility node by AXNodeId. Requires enable() to have been called previously.

Fetches the entire accessibility tree for the root Document

Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.

Fetches the root node. Requires enable() to have been called previously.

Query a DOM node's accessibility subtree for accessible name and role. This command computes the name and role for all nodes in the subtree, including those that are ignored for accessibility, and returns those that mactch the specified name and role. If no DOM node is specified, or the DOM node does not exist, the command returns an error. If neither accessibleName or role is specified, it returns all the accessibility nodes in the subtree.

Types

@type ax_node() :: %{
  backendDOMNodeId: CDPotion.Domain.DOM.backend_node_id() | nil,
  childIds: [ax_node_id()] | nil,
  chromeRole: ax_value() | nil,
  description: ax_value() | nil,
  frameId: CDPotion.Domain.Page.frame_id() | nil,
  ignored: boolean(),
  ignoredReasons: [ax_property()] | nil,
  name: ax_value() | nil,
  nodeId: ax_node_id(),
  parentId: ax_node_id() | nil,
  properties: [ax_property()] | nil,
  role: ax_value() | nil,
  value: ax_value() | nil
}

A node in the accessibility tree.

Link to this type

ax_node_id()

@type ax_node_id() :: String.t()

Unique accessibility node identifier.

Link to this type

ax_property()

@type ax_property() :: %{name: ax_property_name(), value: ax_value()}

description not provided :(

Link to this type

ax_property_name()

@type ax_property_name() ::
  :busy
  | :disabled
  | :editable
  | :focusable
  | :focused
  | :hidden
  | :hiddenRoot
  | :invalid
  | :keyshortcuts
  | :settable
  | :roledescription
  | :live
  | :atomic
  | :relevant
  | :root
  | :autocomplete
  | :hasPopup
  | :level
  | :multiselectable
  | :orientation
  | :multiline
  | :readonly
  | :required
  | :valuemin
  | :valuemax
  | :valuetext
  | :checked
  | :expanded
  | :modal
  | :pressed
  | :selected
  | :activedescendant
  | :controls
  | :describedby
  | :details
  | :errormessage
  | :flowto
  | :labelledby
  | :owns

Values of AXProperty name:

  • from 'busy' to 'roledescription': states which apply to every AX node
  • from 'live' to 'root': attributes which apply to nodes in live regions
  • from 'autocomplete' to 'valuetext': attributes which apply to widgets
  • from 'checked' to 'selected': states which apply to widgets
  • from 'activedescendant' to 'owns' - relationships between elements other than parent/child/sibling.
@type ax_value() :: %{
  relatedNodes: [ax_related_node()] | nil,
  sources: [ax_value_source()] | nil,
  type: ax_value_type(),
  value: any() | nil
}

A single computed AX property.

Link to this type

ax_value_native_source_type()

@type ax_value_native_source_type() ::
  :description
  | :figcaption
  | :label
  | :labelfor
  | :labelwrapped
  | :legend
  | :rubyannotation
  | :tablecaption
  | :title
  | :other

Enum of possible native property sources (as a subtype of a particular AXValueSourceType).

Link to this type

ax_value_source()

@type ax_value_source() :: %{
  attribute: String.t() | nil,
  attributeValue: ax_value() | nil,
  invalid: boolean() | nil,
  invalidReason: String.t() | nil,
  nativeSource: ax_value_native_source_type() | nil,
  nativeSourceValue: ax_value() | nil,
  superseded: boolean() | nil,
  type: ax_value_source_type(),
  value: ax_value() | nil
}

A single source for a computed AX property.

Link to this type

ax_value_source_type()

@type ax_value_source_type() ::
  :attribute | :implicit | :style | :contents | :placeholder | :relatedElement

Enum of possible property sources.

Link to this type

ax_value_type()

@type ax_value_type() ::
  :boolean
  | :tristate
  | :booleanOrUndefined
  | :idref
  | :idrefList
  | :integer
  | :node
  | :nodeList
  | :number
  | :string
  | :computedString
  | :token
  | :tokenList
  | :domRelation
  | :role
  | :internalRole
  | :valueUndefined

Enum of possible property types.

Functions

@spec disable() :: {String.t(), map()}

Disables the accessibility domain.

@spec enable() :: {String.t(), map()}

Enables the accessibility domain which causes AXNodeIds to remain consistent between method calls. This turns on accessibility for the page, which can impact performance until accessibility is disabled.

Link to this function

get_ax_node_and_ancestors(node_id \\ nil, backend_node_id \\ nil, object_id \\ nil)

Fetches a node and all ancestors up to and including the root. Requires enable() to have been called previously.

Parameters:

  • (Optional) node_id: Identifier of the node to get.
  • (Optional) backend_node_id: Identifier of the backend node to get.
  • (Optional) object_id: JavaScript object id of the node wrapper to get.
Link to this function

get_child_ax_nodes(id, frame_id \\ nil)

@spec get_child_ax_nodes(
  ax_node_id(),
  CDPotion.Domain.Page.frame_id()
) :: {String.t(), map()}

Fetches a particular accessibility node by AXNodeId. Requires enable() to have been called previously.

Parameters:

  • (Required) id: description not provided :(
  • (Optional) frame_id: The frame in whose document the node resides. If omitted, the root frame is used.
Link to this function

get_full_ax_tree(depth \\ nil, frame_id \\ nil)

@spec get_full_ax_tree(integer(), CDPotion.Domain.Page.frame_id()) ::
  {String.t(), map()}

Fetches the entire accessibility tree for the root Document

Parameters:

  • (Optional) depth: The maximum depth at which descendants of the root node should be retrieved. If omitted, the full tree is returned.
  • (Optional) frame_id: The frame for whose document the AX tree should be retrieved. If omited, the root frame is used.
Link to this function

get_partial_ax_tree(node_id \\ nil, backend_node_id \\ nil, object_id \\ nil, fetch_relatives \\ nil)

Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.

Parameters:

  • (Optional) node_id: Identifier of the node to get the partial accessibility tree for.
  • (Optional) backend_node_id: Identifier of the backend node to get the partial accessibility tree for.
  • (Optional) object_id: JavaScript object id of the node wrapper to get the partial accessibility tree for.
  • (Optional) fetch_relatives: Whether to fetch this node's ancestors, siblings and children. Defaults to true.
Link to this function

get_root_ax_node(frame_id \\ nil)

@spec get_root_ax_node(CDPotion.Domain.Page.frame_id()) :: {String.t(), map()}

Fetches the root node. Requires enable() to have been called previously.

Parameters:

  • (Optional) frame_id: The frame in whose document the node resides. If omitted, the root frame is used.
Link to this function

query_ax_tree(node_id \\ nil, backend_node_id \\ nil, object_id \\ nil, accessible_name \\ nil, role \\ nil)

Query a DOM node's accessibility subtree for accessible name and role. This command computes the name and role for all nodes in the subtree, including those that are ignored for accessibility, and returns those that mactch the specified name and role. If no DOM node is specified, or the DOM node does not exist, the command returns an error. If neither accessibleName or role is specified, it returns all the accessibility nodes in the subtree.

Parameters:

  • (Optional) node_id: Identifier of the node for the root to query.
  • (Optional) backend_node_id: Identifier of the backend node for the root to query.
  • (Optional) object_id: JavaScript object id of the node wrapper for the root to query.
  • (Optional) accessible_name: Find nodes with this computed name.
  • (Optional) role: Find nodes with this computed role.