# class:accessibility
### class: Accessibility v0.9.0
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).
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 than 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 screen readers themselves. By default, Puppeteer tries to approximate this filtering, exposing only the "interesting" nodes of the tree.
#### Methods
- [accessibility.snapshot(\[options\])](#?product=Puppeteer&version=v1.11.0&show=api-accessibilitysnapshotoptions)v0.9.0
### Methods
#### accessibility.snapshot(\[options\])v0.9.0
- `options` <[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object")>
- `interestingOnly` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")> Prune uninteresting nodes from the tree. Defaults to `true`.
- returns: <[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise")<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object")>> Returns an [AXNode](#?product=Puppeteer&version=v1.11.0&show=api-accessibilitysnapshotoptions "AXNode") object with the following properties:
- `role` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")> The [role](https://www.w3.org/TR/wai-aria/#usage_intro).
- `name` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")> A human readable name for the node.
- `value` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number")> The current value of the node.
- `description` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")> An additional human readable description of the node.
- `keyshortcuts` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")> Keyboard shortcuts associated with this node.
- `roledescription` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")> A human readable alternative to the role.
- `valuetext` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")> A description of the current value.
- `disabled` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")> Whether the node is disabled.
- `expanded` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")> Whether the node is expanded or collapsed.
- `focused` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")> Whether the node is focused.
- `modal` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")> Whether the node is [modal](https://en.wikipedia.org/wiki/Modal_window).
- `multiline` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")> Whether the node text input supports multiline.
- `multiselectable` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")> Whether more than one child can be selected.
- `readonly` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")> Whether the node is read only.
- `required` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")> Whether the node is required.
- `selected` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")> Whether the node is selected in its parent node.
- `checked` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")|"mixed"> Whether the checkbox is checked, or "mixed".
- `pressed` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean")|"mixed"> Whether the toggle button is checked, or "mixed".
- `level` <[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number")> The level of a heading.
- `valuemin` <[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number")> The minimum value in a node.
- `valuemax` <[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number")> The maximum value in a node.
- `autocomplete` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")> What kind of autocomplete is supported by a control.
- `haspopup` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")> What kind of popup is currently being shown for a node.
- `invalid` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")> Whether and in what way this node's value is invalid.
- `orientation` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")> Whether the node is oriented horizontally or vertically.
- `children` <[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array")<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object")>> Child [AXNode](#?product=Puppeteer&version=v1.11.0&show=api-accessibilitysnapshotoptions "AXNode")s of this node, if any.
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.
> **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`.
An example of dumping the entire accessibility tree:
```
const snapshot = await page.accessibility.snapshot();console.log(snapshot);
```
An example of logging the focused node's name:
```
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;}
```
![](images/pptr.png)
puppeteer.js中文网|class:accessibility
puppeteer.js中文文档, puppeteer chrome, puppeteer firefox, puppeteer api 中文文档
puppeteer.js中文网包含了Puppeteer中文文档,最新资讯,应用案例等。Puppeteer 是一个 Node 库,它提供了一个高级 API 来通过 DevTools 协议控制 Chromium 或 Chrome。
- Introduction
- 版本记录
- 概要
- puppeteer-vs-puppeteer-core
- 环境变量
- error-handling
- working-with-chrome-extensions
- class:puppeteer
- class:browserfetcher
- class:browser
- class:page
- class:worker
- class:accessibility
- class:keyboard
- class:mouse
- class:touchscreen
- class:tracing
- class:dialog
- class:consolemessage
- class:frame
- class:executioncontext
- class:jshandle
- class:elementhandle
- class:request
- class:response
- class:securitydetails
- class:target
- class:cdpsession
- class:coverage
- class:timeouterror