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
📌Accessibility.AXRelatedNode
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| backendDOMNodeId | ✔️ | DOM.BackendNodeId | 相关DOM节点的后端节点ID(BackendNodeId)。 | ENThe BackendNodeId of the related DOM node. | |
| idref | string | 提供的IDRef值(如果有的话)。 | ENThe IDRef value provided, if any. | ||
| text | string | 此节点在当前上下文中的文本替代内容。 | ENThe text alternative of this node in the current context. |
📌Accessibility.AXValue
单个计算出的AX属性。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| type | ✔️ | AXValueType | 该值的类型。 | ENThe type of this value. | |
| value | any | 此属性的计算值。 | ENThe computed value of this property. | ||
| relatedNodes | array[AXRelatedNode] | 一个或多个相关节点(如果适用)。 | ENOne or more related nodes, if applicable. | ||
| sources | array[AXValueSource] | 构成此属性计算来源的源。 | ENThe sources which contributed to the computation of this property. |
📌Accessibility.AXValueNativeSourceType
可能的原生属性来源枚举(作为特定AXValueSourceType的子类型)。
允许的值:description、figcaption、label、labelfor、labelwrapped、legend、rubyannotation、tablecaption、title、other
EN
Allowed Values:
description, figcaption, label, labelfor, labelwrapped, legend, rubyannotation, tablecaption, title, other返回类型:string
📌Accessibility.AXValueSource
计算出的无障碍属性(AX)的单一来源。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| type | ✔️ | AXValueSourceType | 这是什么类型的源。 | ENWhat type of source this is. | |
| value | AXValue | 此属性的源值。 | ENThe value of this property source. | ||
| attribute | string | 相关属性的名称(如果有的话)。 | ENThe name of the relevant attribute, if any. | ||
| attributeValue | AXValue | 相关属性的值(如果有的话)。 | ENThe value of the relevant attribute, if any. | ||
| superseded | boolean | 此源是否已被更高优先级的源所取代。 | ENWhether this source is superseded by a higher priority source. | ||
| nativeSource | AXValueNativeSourceType | 此值的原生标记源,例如一个<label>元素。 | ENThe native markup source for this value, e.g. a<label> element. | ||
| nativeSourceValue | AXValue | 原生源的值,例如节点或节点列表。 | ENThe value, such as a node or node list, of the native source. | ||
| invalid | boolean | 此属性的值是否无效。 | ENWhether the value for this property is invalid. | ||
| invalidReason | string | 如果该值无效,则说明其无效的原因。 | ENReason for the value being invalid, if it is. |
📌Accessibility.AXValueSourceType
可能的属性来源枚举。
允许的值:attribute、implicit、style、contents、placeholder、relatedElement
EN
Allowed Values:
attribute, implicit, style, contents, placeholder, relatedElement返回类型:string
📌Accessibility.AXValueType
可能的属性类型枚举。
允许的值:boolean、tristate、booleanOrUndefined、idref、idrefList、integer、node、nodeList、number、string、computedString、token、tokenList、domRelation、role、internalRole、valueUndefined
EN
Allowed Values:
boolean, tristate, booleanOrUndefined, idref, idrefList, integer, node, nodeList, number, string, computedString, token, tokenList, domRelation, role, internalRole, valueUndefined返回类型:string