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 cdp.accessibility.AXNodeId

Unique accessibility node identifier.

class cdp.accessibility.AXValueType

Enum of possible property types.

BOOLEAN = 'boolean'
BOOLEAN_OR_UNDEFINED = 'booleanOrUndefined'
COMPUTED_STRING = 'computedString'
DOM_RELATION = 'domRelation'
IDREF = 'idref'
IDREF_LIST = 'idrefList'
INTEGER = 'integer'
INTERNAL_ROLE = 'internalRole'
NODE = 'node'
NODE_LIST = 'nodeList'
NUMBER = 'number'
ROLE = 'role'
STRING = 'string'
TOKEN = 'token'
TOKEN_LIST = 'tokenList'
TRISTATE = 'tristate'
VALUE_UNDEFINED = 'valueUndefined'
class cdp.accessibility.AXValueSourceType

Enum of possible property sources.

ATTRIBUTE = 'attribute'
CONTENTS = 'contents'
IMPLICIT = 'implicit'
PLACEHOLDER = 'placeholder'
RELATED_ELEMENT = 'relatedElement'
STYLE = 'style'
class cdp.accessibility.AXValueNativeSourceType

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

FIGCAPTION = 'figcaption'
LABEL = 'label'
LABELFOR = 'labelfor'
LABELWRAPPED = 'labelwrapped'
LEGEND = 'legend'
OTHER = 'other'
TABLECAPTION = 'tablecaption'
TITLE = 'title'
class cdp.accessibility.AXValueSource(type_, value=None, attribute=None, attribute_value=None, superseded=None, native_source=None, native_source_value=None, invalid=None, invalid_reason=None)

A single source for a computed AX property.

attribute = None

The name of the relevant attribute, if any.

attribute_value = None

The value of the relevant attribute, if any.

invalid = None

Whether the value for this property is invalid.

invalid_reason = None

Reason for the value being invalid, if it is.

native_source = None

The native markup source for this value, e.g. a <label> element.

native_source_value = None

The value, such as a node or node list, of the native source.

superseded = None

Whether this source is superseded by a higher priority source.

type_ = None

What type of source this is.

value = None

The value of this property source.

class cdp.accessibility.AXRelatedNode(backend_dom_node_id, idref=None, text=None)
backend_dom_node_id = None

The BackendNodeId of the related DOM node.

idref = None

The IDRef value provided, if any.

text = None

The text alternative of this node in the current context.

class cdp.accessibility.AXProperty(name, value)
name = None

The name of this property.

value = None

The value of this property.

class cdp.accessibility.AXValue(type_, value=None, related_nodes=None, sources=None)

A single computed AX property.

related_nodes = None

One or more related nodes, if applicable.

sources = None

The sources which contributed to the computation of this property.

type_ = None

The type of this value.

value = None

The computed value of this property.

class cdp.accessibility.AXPropertyName

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.

ACTIVEDESCENDANT = 'activedescendant'
ATOMIC = 'atomic'
AUTOCOMPLETE = 'autocomplete'
BUSY = 'busy'
CHECKED = 'checked'
CONTROLS = 'controls'
DESCRIBEDBY = 'describedby'
DETAILS = 'details'
DISABLED = 'disabled'
EDITABLE = 'editable'
ERRORMESSAGE = 'errormessage'
EXPANDED = 'expanded'
FLOWTO = 'flowto'
FOCUSABLE = 'focusable'
FOCUSED = 'focused'
HAS_POPUP = 'hasPopup'
HIDDEN = 'hidden'
HIDDEN_ROOT = 'hiddenRoot'
INVALID = 'invalid'
KEYSHORTCUTS = 'keyshortcuts'
LABELLEDBY = 'labelledby'
LEVEL = 'level'
LIVE = 'live'
MODAL = 'modal'
MULTILINE = 'multiline'
MULTISELECTABLE = 'multiselectable'
ORIENTATION = 'orientation'
OWNS = 'owns'
PRESSED = 'pressed'
READONLY = 'readonly'
RELEVANT = 'relevant'
REQUIRED = 'required'
ROLEDESCRIPTION = 'roledescription'
ROOT = 'root'
SELECTED = 'selected'
SETTABLE = 'settable'
VALUEMAX = 'valuemax'
VALUEMIN = 'valuemin'
VALUETEXT = 'valuetext'
class cdp.accessibility.AXNode(node_id, ignored, ignored_reasons=None, role=None, name=None, description=None, value=None, properties=None, child_ids=None, backend_dom_node_id=None)

A node in the accessibility tree.

backend_dom_node_id = None

The backend ID for the associated DOM node, if any.

child_ids = None

IDs for each of this node’s child nodes.

description = None

The accessible description for this Node.

ignored = None

Whether this node is ignored for accessibility

ignored_reasons = None

Collection of reasons why this node is hidden.

name = None

The accessible name for this Node.

node_id = None

Unique identifier for this node.

properties = None

All other properties

role = None

This Node’s role, whether explicit or implicit.

value = None

The value for this Node.

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.

cdp.accessibility.disable()

Disables the accessibility domain.

Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.accessibility.enable()

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.

Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.accessibility.get_full_ax_tree()

Fetches the entire accessibility tree

EXPERIMENTAL

Return type:Generator[Dict[str, Any], Dict[str, Any], List[AXNode]]
Returns:
cdp.accessibility.get_partial_ax_tree(node_id=None, backend_node_id=None, object_id=None, fetch_relatives=None)

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 nodes ancestors, siblings and children. Defaults to true.
Return type:

Generator[Dict[str, Any], Dict[str, Any], List[AXNode]]

Returns:

The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.

Events

There are no events in this module.