feat(new-docs): add TSDoc comments to Accessibility
(#5971)
* feat(new-docs): add tsdoc to `Accessibility`
This commit is contained in:
parent
086c08998b
commit
0b3d52a70e
@ -1,20 +0,0 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Accessibility](./puppeteer.accessibility.md) > [(constructor)](./puppeteer.accessibility._constructor_.md)
|
||||
|
||||
## Accessibility.(constructor)
|
||||
|
||||
Constructs a new instance of the `Accessibility` class
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
constructor(client: CDPSession);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| client | [CDPSession](./puppeteer.cdpsession.md) | |
|
||||
|
@ -4,21 +4,27 @@
|
||||
|
||||
## Accessibility class
|
||||
|
||||
The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class Accessibility
|
||||
```
|
||||
|
||||
## Constructors
|
||||
## Remarks
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(client)](./puppeteer.accessibility._constructor_.md) | | Constructs a new instance of the <code>Accessibility</code> class |
|
||||
Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might have wildly different output.
|
||||
|
||||
Blink - Chrome's rendering engine - has a concept of "accessibility tree", which is then translated into different platform-specific APIs. Accessibility namespace gives users access to the Blink Accessibility Tree.
|
||||
|
||||
Most of the accessibility tree gets filtered out when converting from Blink AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. By default, Puppeteer tries to approximate this filtering, exposing only the "interesting" nodes of the tree.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Accessibility` class.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [snapshot(options)](./puppeteer.accessibility.snapshot.md) | | |
|
||||
| [snapshot(options)](./puppeteer.accessibility.snapshot.md) | | Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page. |
|
||||
|
||||
|
@ -4,22 +4,58 @@
|
||||
|
||||
## Accessibility.snapshot() method
|
||||
|
||||
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
snapshot(options?: {
|
||||
interestingOnly?: boolean;
|
||||
root?: ElementHandle;
|
||||
}): Promise<SerializedAXNode>;
|
||||
snapshot(options?: SnapshotOptions): Promise<SerializedAXNode>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| options | { interestingOnly?: boolean; root?: [ElementHandle](./puppeteer.elementhandle.md)<!-- -->; } | |
|
||||
| options | [SnapshotOptions](./puppeteer.snapshotoptions.md) | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<SerializedAXNode>
|
||||
Promise<[SerializedAXNode](./puppeteer.serializedaxnode.md)<!-- -->>
|
||||
|
||||
An AXNode object represeting the snapshot.
|
||||
|
||||
## Remarks
|
||||
|
||||
\*\*NOTE\*\* The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Puppeteer will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`<!-- -->.
|
||||
|
||||
## Example 1
|
||||
|
||||
An example of dumping the entire accessibility tree:
|
||||
|
||||
```js
|
||||
const snapshot = await page.accessibility.snapshot();
|
||||
console.log(snapshot);
|
||||
|
||||
```
|
||||
|
||||
## Example 2
|
||||
|
||||
An example of logging the focused node's name:
|
||||
|
||||
```js
|
||||
const snapshot = await page.accessibility.snapshot();
|
||||
const node = findFocusedNode(snapshot);
|
||||
console.log(node && node.name);
|
||||
|
||||
function findFocusedNode(node) {
|
||||
if (node.focused)
|
||||
return node;
|
||||
for (const child of node.children || []) {
|
||||
const foundNode = findFocusedNode(child);
|
||||
return foundNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
| Class | Description |
|
||||
| --- | --- |
|
||||
| [Accessibility](./puppeteer.accessibility.md) | |
|
||||
| [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access)<!-- -->. |
|
||||
| [Browser](./puppeteer.browser.md) | |
|
||||
| [BrowserContext](./puppeteer.browsercontext.md) | |
|
||||
| [BrowserFetcher](./puppeteer.browserfetcher.md) | |
|
||||
@ -53,6 +53,8 @@
|
||||
| Interface | Description |
|
||||
| --- | --- |
|
||||
| [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | |
|
||||
| [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. |
|
||||
| [SnapshotOptions](./puppeteer.snapshotoptions.md) | |
|
||||
|
||||
## Variables
|
||||
|
||||
|
11
new-docs/puppeteer.serializedaxnode.autocomplete.md
Normal file
11
new-docs/puppeteer.serializedaxnode.autocomplete.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [autocomplete](./puppeteer.serializedaxnode.autocomplete.md)
|
||||
|
||||
## SerializedAXNode.autocomplete property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
autocomplete?: string;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.checked.md
Normal file
13
new-docs/puppeteer.serializedaxnode.checked.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [checked](./puppeteer.serializedaxnode.checked.md)
|
||||
|
||||
## SerializedAXNode.checked property
|
||||
|
||||
Whether the checkbox is checked, or in a [mixed state](https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
checked?: boolean | 'mixed';
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.children.md
Normal file
13
new-docs/puppeteer.serializedaxnode.children.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [children](./puppeteer.serializedaxnode.children.md)
|
||||
|
||||
## SerializedAXNode.children property
|
||||
|
||||
Children of this node, if there are any.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
children?: SerializedAXNode[];
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.description.md
Normal file
13
new-docs/puppeteer.serializedaxnode.description.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [description](./puppeteer.serializedaxnode.description.md)
|
||||
|
||||
## SerializedAXNode.description property
|
||||
|
||||
An additional human readable description of the node.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
description?: string;
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.disabled.md
Normal file
11
new-docs/puppeteer.serializedaxnode.disabled.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [disabled](./puppeteer.serializedaxnode.disabled.md)
|
||||
|
||||
## SerializedAXNode.disabled property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
disabled?: boolean;
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.expanded.md
Normal file
11
new-docs/puppeteer.serializedaxnode.expanded.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [expanded](./puppeteer.serializedaxnode.expanded.md)
|
||||
|
||||
## SerializedAXNode.expanded property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
expanded?: boolean;
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.focused.md
Normal file
11
new-docs/puppeteer.serializedaxnode.focused.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [focused](./puppeteer.serializedaxnode.focused.md)
|
||||
|
||||
## SerializedAXNode.focused property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
focused?: boolean;
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.haspopup.md
Normal file
11
new-docs/puppeteer.serializedaxnode.haspopup.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [haspopup](./puppeteer.serializedaxnode.haspopup.md)
|
||||
|
||||
## SerializedAXNode.haspopup property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
haspopup?: string;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.invalid.md
Normal file
13
new-docs/puppeteer.serializedaxnode.invalid.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [invalid](./puppeteer.serializedaxnode.invalid.md)
|
||||
|
||||
## SerializedAXNode.invalid property
|
||||
|
||||
Whether and in what way this node's value is invalid.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
invalid?: string;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.keyshortcuts.md
Normal file
13
new-docs/puppeteer.serializedaxnode.keyshortcuts.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [keyshortcuts](./puppeteer.serializedaxnode.keyshortcuts.md)
|
||||
|
||||
## SerializedAXNode.keyshortcuts property
|
||||
|
||||
Any keyboard shortcuts associated with this node.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
keyshortcuts?: string;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.level.md
Normal file
13
new-docs/puppeteer.serializedaxnode.level.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [level](./puppeteer.serializedaxnode.level.md)
|
||||
|
||||
## SerializedAXNode.level property
|
||||
|
||||
The level of a heading.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
level?: number;
|
||||
```
|
45
new-docs/puppeteer.serializedaxnode.md
Normal file
45
new-docs/puppeteer.serializedaxnode.md
Normal file
@ -0,0 +1,45 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md)
|
||||
|
||||
## SerializedAXNode interface
|
||||
|
||||
Represents a Node and the properties of it that are relevant to Accessibility.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface SerializedAXNode
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [autocomplete](./puppeteer.serializedaxnode.autocomplete.md) | string | |
|
||||
| [checked](./puppeteer.serializedaxnode.checked.md) | boolean \| 'mixed' | Whether the checkbox is checked, or in a [mixed state](https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html)<!-- -->. |
|
||||
| [children](./puppeteer.serializedaxnode.children.md) | [SerializedAXNode](./puppeteer.serializedaxnode.md)<!-- -->\[\] | Children of this node, if there are any. |
|
||||
| [description](./puppeteer.serializedaxnode.description.md) | string | An additional human readable description of the node. |
|
||||
| [disabled](./puppeteer.serializedaxnode.disabled.md) | boolean | |
|
||||
| [expanded](./puppeteer.serializedaxnode.expanded.md) | boolean | |
|
||||
| [focused](./puppeteer.serializedaxnode.focused.md) | boolean | |
|
||||
| [haspopup](./puppeteer.serializedaxnode.haspopup.md) | string | |
|
||||
| [invalid](./puppeteer.serializedaxnode.invalid.md) | string | Whether and in what way this node's value is invalid. |
|
||||
| [keyshortcuts](./puppeteer.serializedaxnode.keyshortcuts.md) | string | Any keyboard shortcuts associated with this node. |
|
||||
| [level](./puppeteer.serializedaxnode.level.md) | number | The level of a heading. |
|
||||
| [modal](./puppeteer.serializedaxnode.modal.md) | boolean | |
|
||||
| [multiline](./puppeteer.serializedaxnode.multiline.md) | boolean | |
|
||||
| [multiselectable](./puppeteer.serializedaxnode.multiselectable.md) | boolean | Whether more than one child can be selected. |
|
||||
| [name](./puppeteer.serializedaxnode.name.md) | string | A human readable name for the node. |
|
||||
| [orientation](./puppeteer.serializedaxnode.orientation.md) | string | |
|
||||
| [pressed](./puppeteer.serializedaxnode.pressed.md) | boolean \| 'mixed' | Whether the node is checked or in a mixed state. |
|
||||
| [readonly](./puppeteer.serializedaxnode.readonly.md) | boolean | |
|
||||
| [required](./puppeteer.serializedaxnode.required.md) | boolean | |
|
||||
| [role](./puppeteer.serializedaxnode.role.md) | string | The [role](https://www.w3.org/TR/wai-aria/#usage_intro) of the node. |
|
||||
| [roledescription](./puppeteer.serializedaxnode.roledescription.md) | string | A human readable alternative to the role. |
|
||||
| [selected](./puppeteer.serializedaxnode.selected.md) | boolean | |
|
||||
| [value](./puppeteer.serializedaxnode.value.md) | string \| number | The current value of the node. |
|
||||
| [valuemax](./puppeteer.serializedaxnode.valuemax.md) | number | |
|
||||
| [valuemin](./puppeteer.serializedaxnode.valuemin.md) | number | |
|
||||
| [valuetext](./puppeteer.serializedaxnode.valuetext.md) | string | A description of the current value. |
|
||||
|
11
new-docs/puppeteer.serializedaxnode.modal.md
Normal file
11
new-docs/puppeteer.serializedaxnode.modal.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [modal](./puppeteer.serializedaxnode.modal.md)
|
||||
|
||||
## SerializedAXNode.modal property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
modal?: boolean;
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.multiline.md
Normal file
11
new-docs/puppeteer.serializedaxnode.multiline.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [multiline](./puppeteer.serializedaxnode.multiline.md)
|
||||
|
||||
## SerializedAXNode.multiline property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
multiline?: boolean;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.multiselectable.md
Normal file
13
new-docs/puppeteer.serializedaxnode.multiselectable.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [multiselectable](./puppeteer.serializedaxnode.multiselectable.md)
|
||||
|
||||
## SerializedAXNode.multiselectable property
|
||||
|
||||
Whether more than one child can be selected.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
multiselectable?: boolean;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.name.md
Normal file
13
new-docs/puppeteer.serializedaxnode.name.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [name](./puppeteer.serializedaxnode.name.md)
|
||||
|
||||
## SerializedAXNode.name property
|
||||
|
||||
A human readable name for the node.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
name?: string;
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.orientation.md
Normal file
11
new-docs/puppeteer.serializedaxnode.orientation.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [orientation](./puppeteer.serializedaxnode.orientation.md)
|
||||
|
||||
## SerializedAXNode.orientation property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
orientation?: string;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.pressed.md
Normal file
13
new-docs/puppeteer.serializedaxnode.pressed.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [pressed](./puppeteer.serializedaxnode.pressed.md)
|
||||
|
||||
## SerializedAXNode.pressed property
|
||||
|
||||
Whether the node is checked or in a mixed state.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
pressed?: boolean | 'mixed';
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.readonly.md
Normal file
11
new-docs/puppeteer.serializedaxnode.readonly.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [readonly](./puppeteer.serializedaxnode.readonly.md)
|
||||
|
||||
## SerializedAXNode.readonly property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
readonly?: boolean;
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.required.md
Normal file
11
new-docs/puppeteer.serializedaxnode.required.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [required](./puppeteer.serializedaxnode.required.md)
|
||||
|
||||
## SerializedAXNode.required property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
required?: boolean;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.role.md
Normal file
13
new-docs/puppeteer.serializedaxnode.role.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [role](./puppeteer.serializedaxnode.role.md)
|
||||
|
||||
## SerializedAXNode.role property
|
||||
|
||||
The [role](https://www.w3.org/TR/wai-aria/#usage_intro) of the node.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
role: string;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.roledescription.md
Normal file
13
new-docs/puppeteer.serializedaxnode.roledescription.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [roledescription](./puppeteer.serializedaxnode.roledescription.md)
|
||||
|
||||
## SerializedAXNode.roledescription property
|
||||
|
||||
A human readable alternative to the role.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
roledescription?: string;
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.selected.md
Normal file
11
new-docs/puppeteer.serializedaxnode.selected.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [selected](./puppeteer.serializedaxnode.selected.md)
|
||||
|
||||
## SerializedAXNode.selected property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
selected?: boolean;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.value.md
Normal file
13
new-docs/puppeteer.serializedaxnode.value.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [value](./puppeteer.serializedaxnode.value.md)
|
||||
|
||||
## SerializedAXNode.value property
|
||||
|
||||
The current value of the node.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
value?: string | number;
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.valuemax.md
Normal file
11
new-docs/puppeteer.serializedaxnode.valuemax.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [valuemax](./puppeteer.serializedaxnode.valuemax.md)
|
||||
|
||||
## SerializedAXNode.valuemax property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
valuemax?: number;
|
||||
```
|
11
new-docs/puppeteer.serializedaxnode.valuemin.md
Normal file
11
new-docs/puppeteer.serializedaxnode.valuemin.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [valuemin](./puppeteer.serializedaxnode.valuemin.md)
|
||||
|
||||
## SerializedAXNode.valuemin property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
valuemin?: number;
|
||||
```
|
13
new-docs/puppeteer.serializedaxnode.valuetext.md
Normal file
13
new-docs/puppeteer.serializedaxnode.valuetext.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SerializedAXNode](./puppeteer.serializedaxnode.md) > [valuetext](./puppeteer.serializedaxnode.valuetext.md)
|
||||
|
||||
## SerializedAXNode.valuetext property
|
||||
|
||||
A description of the current value.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
valuetext?: string;
|
||||
```
|
13
new-docs/puppeteer.snapshotoptions.interestingonly.md
Normal file
13
new-docs/puppeteer.snapshotoptions.interestingonly.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SnapshotOptions](./puppeteer.snapshotoptions.md) > [interestingOnly](./puppeteer.snapshotoptions.interestingonly.md)
|
||||
|
||||
## SnapshotOptions.interestingOnly property
|
||||
|
||||
Prune unintersting nodes from the tree.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
interestingOnly?: boolean;
|
||||
```
|
20
new-docs/puppeteer.snapshotoptions.md
Normal file
20
new-docs/puppeteer.snapshotoptions.md
Normal file
@ -0,0 +1,20 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SnapshotOptions](./puppeteer.snapshotoptions.md)
|
||||
|
||||
## SnapshotOptions interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface SnapshotOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [interestingOnly](./puppeteer.snapshotoptions.interestingonly.md) | boolean | Prune unintersting nodes from the tree. |
|
||||
| [root](./puppeteer.snapshotoptions.root.md) | [ElementHandle](./puppeteer.elementhandle.md) | Prune unintersting nodes from the tree. |
|
||||
|
13
new-docs/puppeteer.snapshotoptions.root.md
Normal file
13
new-docs/puppeteer.snapshotoptions.root.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [SnapshotOptions](./puppeteer.snapshotoptions.md) > [root](./puppeteer.snapshotoptions.root.md)
|
||||
|
||||
## SnapshotOptions.root property
|
||||
|
||||
Prune unintersting nodes from the tree.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
root?: ElementHandle;
|
||||
```
|
@ -18,44 +18,166 @@ import { CDPSession } from './Connection';
|
||||
import { ElementHandle } from './JSHandle';
|
||||
import Protocol from './protocol';
|
||||
|
||||
interface SerializedAXNode {
|
||||
/**
|
||||
* Represents a Node and the properties of it that are relevant to Accessibility.
|
||||
* @public
|
||||
*/
|
||||
export interface SerializedAXNode {
|
||||
/**
|
||||
* The {@link https://www.w3.org/TR/wai-aria/#usage_intro | role} of the node.
|
||||
*/
|
||||
role: string;
|
||||
/**
|
||||
* A human readable name for the node.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The current value of the node.
|
||||
*/
|
||||
value?: string | number;
|
||||
/**
|
||||
* An additional human readable description of the node.
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Any keyboard shortcuts associated with this node.
|
||||
*/
|
||||
keyshortcuts?: string;
|
||||
/**
|
||||
* A human readable alternative to the role.
|
||||
*/
|
||||
roledescription?: string;
|
||||
/**
|
||||
* A description of the current value.
|
||||
*/
|
||||
valuetext?: string;
|
||||
disabled?: boolean;
|
||||
expanded?: boolean;
|
||||
focused?: boolean;
|
||||
modal?: boolean;
|
||||
multiline?: boolean;
|
||||
/**
|
||||
* Whether more than one child can be selected.
|
||||
*/
|
||||
multiselectable?: boolean;
|
||||
readonly?: boolean;
|
||||
required?: boolean;
|
||||
selected?: boolean;
|
||||
/**
|
||||
* Whether the checkbox is checked, or in a {@link https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html | mixed state}.
|
||||
*/
|
||||
checked?: boolean | 'mixed';
|
||||
/**
|
||||
* Whether the node is checked or in a mixed state.
|
||||
*/
|
||||
pressed?: boolean | 'mixed';
|
||||
/**
|
||||
* The level of a heading.
|
||||
*/
|
||||
level?: number;
|
||||
valuemin?: number;
|
||||
valuemax?: number;
|
||||
autocomplete?: string;
|
||||
haspopup?: string;
|
||||
/**
|
||||
* Whether and in what way this node's value is invalid.
|
||||
*/
|
||||
invalid?: string;
|
||||
orientation?: string;
|
||||
/**
|
||||
* Children of this node, if there are any.
|
||||
*/
|
||||
children?: SerializedAXNode[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface SnapshotOptions {
|
||||
/**
|
||||
* Prune unintersting nodes from the tree.
|
||||
* @defaultValue true
|
||||
*/
|
||||
interestingOnly?: boolean;
|
||||
/**
|
||||
* Prune unintersting nodes from the tree.
|
||||
* @defaultValue The root node of the entire page.
|
||||
*/
|
||||
root?: ElementHandle;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Accessibility class provides methods for inspecting Chromium's
|
||||
* accessibility tree. The accessibility tree is used by assistive technology
|
||||
* such as {@link https://en.wikipedia.org/wiki/Screen_reader | screen readers} or
|
||||
* {@link https://en.wikipedia.org/wiki/Switch_access | switches}.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* Accessibility is a very platform-specific thing. On different platforms,
|
||||
* there are different screen readers that might have wildly different output.
|
||||
*
|
||||
* Blink - Chrome's rendering engine - has a concept of "accessibility tree",
|
||||
* which is then translated into different platform-specific APIs. Accessibility
|
||||
* namespace gives users access to the Blink Accessibility Tree.
|
||||
*
|
||||
* Most of the accessibility tree gets filtered out when converting from Blink
|
||||
* AX Tree to Platform-specific AX-Tree or by assistive technologies themselves.
|
||||
* By default, Puppeteer tries to approximate this filtering, exposing only
|
||||
* the "interesting" nodes of the tree.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class Accessibility {
|
||||
private _client: CDPSession;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(client: CDPSession) {
|
||||
this._client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures the current state of the accessibility tree.
|
||||
* The returned object represents the root accessible node of the page.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* **NOTE** The Chromium accessibility tree contains nodes that go unused on most platforms and by
|
||||
* most screen readers. Puppeteer will discard them as well for an easier to process tree,
|
||||
* unless `interestingOnly` is set to `false`.
|
||||
*
|
||||
* @example
|
||||
* An example of dumping the entire accessibility tree:
|
||||
* ```js
|
||||
* const snapshot = await page.accessibility.snapshot();
|
||||
* console.log(snapshot);
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* An example of logging the focused node's name:
|
||||
* ```js
|
||||
* const snapshot = await page.accessibility.snapshot();
|
||||
* const node = findFocusedNode(snapshot);
|
||||
* console.log(node && node.name);
|
||||
*
|
||||
* function findFocusedNode(node) {
|
||||
* if (node.focused)
|
||||
* return node;
|
||||
* for (const child of node.children || []) {
|
||||
* const foundNode = findFocusedNode(child);
|
||||
* return foundNode;
|
||||
* }
|
||||
* return null;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @returns An AXNode object represeting the snapshot.
|
||||
*
|
||||
*/
|
||||
public async snapshot(
|
||||
options: { interestingOnly?: boolean; root?: ElementHandle } = {}
|
||||
options: SnapshotOptions = {}
|
||||
): Promise<SerializedAXNode> {
|
||||
const { interestingOnly = true, root = null } = options;
|
||||
const { nodes } = await this._client.send('Accessibility.getFullAXTree');
|
||||
|
@ -612,6 +612,13 @@ function compareDocumentations(actual, expected) {
|
||||
expectedName: 'VisionDeficiency',
|
||||
},
|
||||
],
|
||||
[
|
||||
'Method Accessibility.snapshot() options',
|
||||
{
|
||||
actualName: 'Object',
|
||||
expectedName: 'SnapshotOptions',
|
||||
},
|
||||
],
|
||||
]);
|
||||
|
||||
const expectedForSource = expectedNamingMismatches.get(source);
|
||||
|
Loading…
Reference in New Issue
Block a user