Accessibility#
This CDP domain is experimental.
Types#
Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.
- class AXValueType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Enum of possible property types.
- BOOLEAN = 'boolean'#
- TRISTATE = 'tristate'#
- BOOLEAN_OR_UNDEFINED = 'booleanOrUndefined'#
- IDREF = 'idref'#
- IDREF_LIST = 'idrefList'#
- INTEGER = 'integer'#
- NODE = 'node'#
- NODE_LIST = 'nodeList'#
- NUMBER = 'number'#
- STRING = 'string'#
- COMPUTED_STRING = 'computedString'#
- TOKEN = 'token'#
- TOKEN_LIST = 'tokenList'#
- DOM_RELATION = 'domRelation'#
- ROLE = 'role'#
- INTERNAL_ROLE = 'internalRole'#
- VALUE_UNDEFINED = 'valueUndefined'#
- class AXValueSourceType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Enum of possible property sources.
- ATTRIBUTE = 'attribute'#
- IMPLICIT = 'implicit'#
- STYLE = 'style'#
- CONTENTS = 'contents'#
- PLACEHOLDER = 'placeholder'#
- RELATED_ELEMENT = 'relatedElement'#
- class AXValueNativeSourceType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Enum of possible native property sources (as a subtype of a particular AXValueSourceType).
- DESCRIPTION = 'description'#
- FIGCAPTION = 'figcaption'#
- LABEL = 'label'#
- LABELFOR = 'labelfor'#
- LABELWRAPPED = 'labelwrapped'#
- LEGEND = 'legend'#
- RUBYANNOTATION = 'rubyannotation'#
- TABLECAPTION = 'tablecaption'#
- TITLE = 'title'#
- OTHER = 'other'#
- class AXValueSource(type_, value=None, attribute=None, attribute_value=None, superseded=None, native_source=None, native_source_value=None, invalid=None, invalid_reason=None)[source]#
A single source for a computed AX property.
-
type_:
AXValueSourceType# What type of source this is.
-
native_source:
Optional[AXValueNativeSourceType] = None# The native markup source for this value, e.g. a
<label>element.
-
type_:
- class AXRelatedNode(backend_dom_node_id, idref=None, text=None)[source]#
-
backend_dom_node_id:
BackendNodeId# The BackendNodeId of the related DOM node.
-
backend_dom_node_id:
- class AXProperty(name, value)[source]#
-
name:
AXPropertyName# The name of this property.
-
name:
- class AXValue(type_, value=None, related_nodes=None, sources=None)[source]#
A single computed AX property.
-
type_:
AXValueType# The type of this value.
One or more related nodes, if applicable.
-
sources:
Optional[List[AXValueSource]] = None# The sources which contributed to the computation of this property.
-
type_:
- class AXPropertyName(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
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.
- ACTIONS = 'actions'#
- BUSY = 'busy'#
- DISABLED = 'disabled'#
- EDITABLE = 'editable'#
- FOCUSABLE = 'focusable'#
- FOCUSED = 'focused'#
- HIDDEN = 'hidden'#
- HIDDEN_ROOT = 'hiddenRoot'#
- INVALID = 'invalid'#
- KEYSHORTCUTS = 'keyshortcuts'#
- SETTABLE = 'settable'#
- ROLEDESCRIPTION = 'roledescription'#
- LIVE = 'live'#
- ATOMIC = 'atomic'#
- RELEVANT = 'relevant'#
- ROOT = 'root'#
- AUTOCOMPLETE = 'autocomplete'#
- HAS_POPUP = 'hasPopup'#
- LEVEL = 'level'#
- MULTISELECTABLE = 'multiselectable'#
- ORIENTATION = 'orientation'#
- MULTILINE = 'multiline'#
- READONLY = 'readonly'#
- REQUIRED = 'required'#
- VALUEMIN = 'valuemin'#
- VALUEMAX = 'valuemax'#
- VALUETEXT = 'valuetext'#
- CHECKED = 'checked'#
- EXPANDED = 'expanded'#
- MODAL = 'modal'#
- PRESSED = 'pressed'#
- SELECTED = 'selected'#
- ACTIVEDESCENDANT = 'activedescendant'#
- CONTROLS = 'controls'#
- DESCRIBEDBY = 'describedby'#
- DETAILS = 'details'#
- ERRORMESSAGE = 'errormessage'#
- FLOWTO = 'flowto'#
- LABELLEDBY = 'labelledby'#
- OWNS = 'owns'#
- URL = 'url'#
- class AXNode(node_id, ignored, ignored_reasons=None, role=None, chrome_role=None, name=None, description=None, value=None, properties=None, parent_id=None, child_ids=None, backend_dom_node_id=None, frame_id=None)[source]#
A node in the accessibility tree.
-
ignored_reasons:
Optional[List[AXProperty]] = None# Collection of reasons why this node is hidden.
-
properties:
Optional[List[AXProperty]] = None# All other properties
-
backend_dom_node_id:
Optional[BackendNodeId] = None# The backend ID for the associated DOM node, if any.
-
ignored_reasons:
Commands#
Each command is a generator function. The return
type Generator[x, y, z] indicates that the generator
yields arguments of type x, it must be resumed with
an argument of type y, and it returns type z. In
this library, types x and y are the same for all
commands, and z is the return type you should pay attention
to. For more information, see
Getting Started: Commands.
- enable()[source]#
Enables the accessibility domain which causes
AXNodeId’s to remain consistent between method calls. This turns on accessibility for the page, which can impact performance until accessibility is disabled.
- get_ax_node_and_ancestors(node_id=None, backend_node_id=None, object_id=None)[source]#
Fetches a node and all ancestors up to and including the root. Requires
enable()to have been called previously.EXPERIMENTAL
- Parameters:
node_id (
Optional[NodeId]) – (Optional) Identifier of the node to get.backend_node_id (
Optional[BackendNodeId]) – (Optional) Identifier of the backend node to get.object_id (
Optional[RemoteObjectId]) – (Optional) JavaScript object id of the node wrapper to get.
- Return type:
- Returns:
- get_child_ax_nodes(id_, frame_id=None)[source]#
Fetches a particular accessibility node by AXNodeId. Requires
enable()to have been called previously.EXPERIMENTAL
- get_full_ax_tree(depth=None, frame_id=None)[source]#
Fetches the entire accessibility tree for the root Document
EXPERIMENTAL
- Parameters:
- Return type:
- Returns:
- get_partial_ax_tree(node_id=None, backend_node_id=None, object_id=None, fetch_relatives=None)[source]#
Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
EXPERIMENTAL
- Parameters:
node_id (
Optional[NodeId]) – (Optional) Identifier of the node to get the partial accessibility tree for.backend_node_id (
Optional[BackendNodeId]) – (Optional) Identifier of the backend node to get the partial accessibility tree for.object_id (
Optional[RemoteObjectId]) – (Optional) JavaScript object id of the node wrapper to get the partial accessibility tree for.fetch_relatives (
Optional[bool]) – (Optional) Whether to fetch this node’s ancestors, siblings and children. Defaults to true.
- Return type:
- Returns:
The
Accessibility.AXNodefor this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
- get_root_ax_node(frame_id=None)[source]#
Fetches the root node. Requires
enable()to have been called previously.EXPERIMENTAL
- query_ax_tree(node_id=None, backend_node_id=None, object_id=None, accessible_name=None, role=None)[source]#
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 match 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
accessibleNameorroleis specified, it returns all the accessibility nodes in the subtree.EXPERIMENTAL
- Parameters:
node_id (
Optional[NodeId]) – (Optional) Identifier of the node for the root to query.backend_node_id (
Optional[BackendNodeId]) – (Optional) Identifier of the backend node for the root to query.object_id (
Optional[RemoteObjectId]) – (Optional) JavaScript object id of the node wrapper for the root to query.accessible_name (
Optional[str]) – (Optional) Find nodes with this computed name.role (
Optional[str]) – (Optional) Find nodes with this computed role.
- Return type:
- Returns:
A list of
Accessibility.AXNodematching the specified attributes, including nodes that are ignored for accessibility.
Events#
Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.