Accessibility🧪
✅️️ Methods
🔨Accessibility.disable
禁用无障碍功能域。
EN
🔨Accessibility.enable
启用无障碍功能域,使AXNodeId在方法调用之间保持一致。这会开启页面的无障碍功能,在无障碍功能被禁用之前可能会影响性能。
EN
AXNodeIds to remain consistent between method calls. This turns on accessibility for the page, which can impact performance until accessibility is disabled.🔨Accessibility.getAXNodeAndAncestors🧪
获取一个节点及其所有祖先节点,直至包括根节点。需要事先调用 enable() 方法。
EN
enable() to have been called previously.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| nodeId | DOM.NodeId | 获取节点的标识符。 | ENIdentifier of the node to get. | ||
| backendNodeId | DOM.BackendNodeId | 获取后端节点的标识符。 | ENIdentifier of the backend node to get. | ||
| objectId | Runtime.RemoteObjectId | 要获取的节点包装器的JavaScript对象ID。 | ENJavaScript object id of the node wrapper to get. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| nodes | array[AXNode] |
🔨Accessibility.getChildAXNodes🧪
通过AXNodeId获取特定的无障碍节点。需要先前已调用enable()。
EN
enable() to have been called previously.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| id | ✔️ | AXNodeId | |||
| frameId | Page.FrameId | 节点所在的文档框架。如果省略,则使用根框架。 | ENThe frame in whose document the node resides. If omitted, the root frame is used. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| nodes | array[AXNode] |
🔨Accessibility.getFullAXTree🧪
获取根文档的完整无障碍访问树
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| depth | integer | 根节点后代的检索最大深度。若省略,则返回完整树结构。 | ENThe maximum depth at which descendants of the root node should be retrieved. If omitted, the full tree is returned. | ||
| frameId | Page.FrameId | 应检索其文档的无障碍(AX)树的框架。如果省略,则使用根框架。 | ENThe frame for whose document the AX tree should be retrieved. If omitted, the root frame is used. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| nodes | array[AXNode] |
🔨Accessibility.getPartialAXTree🧪
获取此DOM节点(如果存在)的可访问性节点和部分可访问性树。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| nodeId | DOM.NodeId | 获取部分可访问性树的节点标识符。 | ENIdentifier of the node to get the partial accessibility tree for. | ||
| backendNodeId | DOM.BackendNodeId | 获取部分无障碍树的后端节点标识符。 | ENIdentifier of the backend node to get the partial accessibility tree for. | ||
| objectId | Runtime.RemoteObjectId | 节点包装器的JavaScript对象ID,用于获取部分可访问性树。 | ENJavaScript object id of the node wrapper to get the partial accessibility tree for. | ||
| fetchRelatives | boolean | 是否获取此节点的祖先、兄弟节点和子节点。默认为 true。 | ENWhether to fetch this node's ancestors, siblings and children. Defaults to true. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| nodes | array[AXNode] | 此DOM节点的Accessibility.AXNode(如果存在),以及根据请求包含其祖先节点、兄弟节点和子节点。 | ENTheAccessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested. |
🔨Accessibility.getRootAXNode🧪
获取根节点。需要之前已经调用过 enable() 方法。
EN
enable() to have been called previously.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | Page.FrameId | 节点所在的文档框架。如果省略,则使用根框架。 | ENThe frame in whose document the node resides. If omitted, the root frame is used. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| node | AXNode |
🔨Accessibility.queryAXTree🧪
查询DOM节点的无障碍子树以获取无障碍名称和角色。该命令会计算子树中所有节点的名称和角色,包括那些在无障碍功能中被忽略的节点,并返回与指定名称和角色匹配的节 点。如果未指定DOM节点,或DOM节点不存在,该命令将返回错误。如果未指定accessibleName或role,则返回子树中的所有无障碍节点。
EN
accessibleName or role is specified, it returns all the accessibility nodes in the subtree.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| nodeId | DOM.NodeId | 查询根节点的标识符。 | ENIdentifier of the node for the root to query. | ||
| backendNodeId | DOM.BackendNodeId | 查询根节点的后端节点标识符。 | ENIdentifier of the backend node for the root to query. | ||
| objectId | Runtime.RemoteObjectId | 用于查询的根节点包 装器的JavaScript对象ID。 | ENJavaScript object id of the node wrapper for the root to query. | ||
| accessibleName | string | 查找具有此计算名称的节点。 | ENFind nodes with this computed name. | ||
| role | string | 查找具有此计算角色的节点。 | ENFind nodes with this computed role. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| nodes | array[AXNode] | 一个Accessibility.AXNode列表,匹配指定的属性,包括那些在无障碍功能中被忽略的节点。 | ENA list ofAccessibility.AXNode matching the specified attributes, including nodes that are ignored for accessibility. |
✅️️ Events
👋Accessibility.loadComplete🧪
loadComplete事件反映了当网页完成加载时,浏览器向辅助技术发送的加载完成事件。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| root | ✔️ | AXNode | 新文档根节点。 | ENNew document root node. |
👋Accessibility.nodesUpdated🧪
每当先前请求的节点在树中发生更改时,就会发送 nodesUpdated 事件。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| nodes | ✔️ | array[AXNode] | 已更新节点数据。 | ENUpdated node data. |
✅️️ Types
📌Accessibility.AXNode
可访问性树中的一个节点。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| nodeId | ✔️ | AXNodeId | 此节点的唯一标识符。 | ENUnique identifier for this node. | |
| ignored | ✔️ | boolean | 此节点是否被忽略以用于无障碍访问 | ENWhether this node is ignored for accessibility | |
| ignoredReasons | array[AXProperty] | 此节点被隐藏的原因集合。 | ENCollection of reasons why this node is hidden. | ||
| role | AXValue | 这个Node的角色,无论是显式还是隐式的。 | ENThisNode's role, whether explicit or implicit. | ||
| chromeRole | AXValue | 此Node的Chrome原始角色。 | ENThisNode's Chrome raw role. | ||
| name | AXValue | 此Node的可访问名称。 | ENThe accessible name for thisNode. | ||
| description | AXValue | 此 Node 的可访问描述。 | ENThe accessible description for thisNode. | ||
| value | AXValue | 这个Node的值。 | ENThe value for thisNode. | ||
| properties | array[AXProperty] | 所有其他属性 | ENAll other properties | ||
| parentId | AXNodeId | 此节点的父节点ID。 | ENID for this node's parent. | ||
| childIds | array[AXNodeId] | 此节点的每个子节点的ID。 | ENIDs for each of this node's child nodes. | ||
| backendDOMNodeId | DOM.BackendNodeId | 关联DOM节点的后端ID(如果存在)。 | ENThe backend ID for the associated DOM node, if any. | ||
| frameId | Page.FrameId | 与此节点文档关联的框架的框架ID。 | ENThe frame ID for the frame associated with this nodes document. |
📌Accessibility.AXNodeId
唯一的无障碍节点标识符。
EN
返回类型:string
📌Accessibility.AXProperty
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | AXPropertyName | 此属性的名称。 | ENThe name of this property. | |
| value | ✔️ | AXValue | 该属性的值。 | ENThe value of this property. |
📌Accessibility.AXPropertyName
AXProperty 名称的取值:
- 从 'busy' 到 'roledescription':适用于所有 AX 节点的状态
- 从 'live' 到 'root':适用于实时区域节点的属性
- 从 'autocomplete' 到 'valuetext':适用于控件的属性
- 从 'checked' 到 'selected':适用于控件的状态
- 从 'activedescendant' 到 'owns':除父子/兄弟关系之外的元素间关系
- 从 'activeFullscreenElement' 到 'uninteresting':此节点被隐藏的 原因
允许的取值:actions, 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, url, activeFullscreenElement, activeModalDialog, activeAriaModalDialog, ariaHiddenElement, ariaHiddenSubtree, emptyAlt, emptyText, inertElement, inertSubtree, labelContainer, labelFor, notRendered, notVisible, presentationalRole, probablyPresentational, inactiveCarouselTabContent, uninteresting
EN
- 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
- from 'activeFullscreenElement' to 'uninteresting': reasons why this noode is hidden
Allowed Values:
actions, 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, url, activeFullscreenElement, activeModalDialog, activeAriaModalDialog, ariaHiddenElement, ariaHiddenSubtree, emptyAlt, emptyText, inertElement, inertSubtree, labelContainer, labelFor, notRendered, notVisible, presentationalRole, probablyPresentational, inactiveCarouselTabContent, uninteresting返回类型:string