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

FieldTypeDescription
nodesarrayArray of accessibility tree nodes
nodes[].nodeIdstringUnique identifier for the accessibility node
nodes[].rolestringARIA role of the element (e.g. button, heading, link)
nodes[].namestringAccessible name of the element
nodes[].descriptionstringAccessible description of the element
nodes[].valuestringCurrent value, if applicable
nodes[].propertiesobjectAdditional accessibility properties
nodes[].childrenarrayChild 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

ConditionExit codeStderr
Chrome not connected2error: connecting to Chrome: ...
Timeout3error: 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