hubcap a11y
Get the accessibility tree of the current page.
When to use
Use a11y to retrieve the full accessibility tree for auditing purposes. It shows roles, names, and states of all accessible elements, making it useful for verifying ARIA attributes, screen reader compatibility, and overall accessibility compliance.
Usage
hubcap a11y Arguments
None.
Flags
None.
Output
| Field | Type | Description |
|---|---|---|
| nodes | array | Array of accessibility tree nodes |
| nodes[].nodeId | string | Unique identifier for the accessibility node |
| nodes[].role | string | ARIA role of the element (e.g. button, heading, link) |
| nodes[].name | string | Accessible name of the element |
| nodes[].description | string | Accessible description of the element |
| nodes[].value | string | Current value, if applicable |
| nodes[].properties | object | Additional accessibility properties |
| nodes[].children | array | Child nodes in the accessibility tree |
{
"nodes": [
{
"nodeId": "1",
"role": "WebArea",
"name": "Example Domain",
"children": [
{
"nodeId": "2",
"role": "heading",
"name": "Example Domain"
},
{
"nodeId": "3",
"role": "link",
"name": "More information..."
}
]
}
]
} Errors
| Condition | Exit code | Stderr |
|---|---|---|
| Chrome not connected | 2 | error: connecting to Chrome: ... |
| Timeout | 3 | error: timeout |
Examples
Get the accessibility tree:
hubcap a11y Find all elements with the “button” role:
hubcap a11y | jq '.. | objects | select(.role == "button")' Audit a page for missing accessible names on interactive elements:
hubcap goto --wait "https://example.com" && hubcap a11y | jq '.. | objects | select(.role == "button" or .role == "link") | select(.name == "" or .name == null)' See also
- query - query DOM elements by selector
- domsnapshot - capture a complete DOM snapshot