What are AX roles?
Every UI element in a macOS app has an accessibility role that describes what it is. Roles are part of Apple’s Accessibility API and follow the naming conventionAXRoleName.
You can use roles with commands like find, click, and snapshot to target specific types of elements:
Interactive elements
These roles represent elements users can interact with.AXButton
A clickable button. Common attributes:AXTitle- Button textAXEnabled- Whether the button is clickableAXFocused- Whether the button has focus
AXPress- Click the button
AXTextField
A single-line text input field. Common attributes:AXValue- Current text contentAXPlaceholderValue- Placeholder textAXEnabled- Whether the field is editable
AXTextArea
A multi-line text input area. Common attributes:AXValue- Current text contentAXEnabled- Whether the area is editableAXNumberOfCharacters- Character count
AXCheckBox
A checkbox that can be checked or unchecked. Common attributes:AXTitle- Checkbox labelAXValue- 0 (unchecked) or 1 (checked)AXEnabled- Whether the checkbox is interactive
AXRadioButton
A radio button for selecting one option from a group. Common attributes:AXTitle- Radio button labelAXValue- 0 (unselected) or 1 (selected)
AXPopUpButton
A dropdown menu button. Common attributes:AXTitle- Button labelAXValue- Currently selected option
AXComboBox
A combination of a text field and dropdown. Common attributes:AXValue- Current text/selectionAXEnabled- Whether the combo box is interactive
AXSlider
A slider for selecting a value from a range. Common attributes:AXValue- Current slider valueAXMinValue- Minimum valueAXMaxValue- Maximum value
AXIncrement- Increase valueAXDecrement- Decrease value
AXSwitch
A toggle switch (common in iOS-style interfaces). Common attributes:AXValue- 0 (off) or 1 (on)AXTitle- Switch label
AXLink
A clickable hyperlink. Common attributes:AXTitle- Link textAXURL- Link destination
AXMenuButton
A button that opens a menu. Common attributes:AXTitle- Button label
AXMenuItem
An item within a menu. Common attributes:AXTitle- Menu item textAXEnabled- Whether the item is selectable
AXMenuBarItem
An item in the menu bar. Common attributes:AXTitle- Menu bar item text
AXTab
A tab in a tab group. Common attributes:AXTitle- Tab labelAXValue- Selected state
AXSearchField
A text field specifically for search input. Common attributes:AXValue- Current search textAXPlaceholderValue- Placeholder text
AXSecureTextField
A password input field (text is masked). Common attributes:AXValue- Masked password value
AXStepper
Increment/decrement control (up/down arrows). Common actions:AXIncrement- Increase valueAXDecrement- Decrease value
AXDisclosureTriangle
A triangle that expands/collapses content. Common attributes:AXValue- 0 (collapsed) or 1 (expanded)
AXColorWell
A color picker control. Common attributes:AXValue- Current color value
Structural elements
These roles organize and contain other elements.AXWindow
An application window. Common attributes:AXTitle- Window titleAXMain- Whether this is the main windowAXFocused- Whether the window has focus
AXGroup
A generic container for grouping elements. Common attributes:AXTitle- Group label (if any)AXDescription- Group description
AXScrollArea
A scrollable area containing content. Common attributes:AXChildren- Content inside the scroll areaAXHorizontalScrollBar- Horizontal scrollbar elementAXVerticalScrollBar- Vertical scrollbar element
AXSplitGroup
A container with resizable panes.AXToolbar
A toolbar containing buttons and controls. Common attributes:AXTitle- Toolbar name
AXTabGroup
A container for tabs. Common attributes:AXTabs- Array of tab elements
Display elements
These roles present information to users.AXStaticText
Non-editable text content. Common attributes:AXValue- Text content
AXImage
An image or icon. Common attributes:AXDescription- Image descriptionAXTitle- Image title
AXProgressIndicator
A progress bar or spinner. Common attributes:AXValue- Current progress valueAXMinValue- Minimum value (usually 0)AXMaxValue- Maximum value (usually 100)
AXValueIndicator
Displays a value (like a label showing a slider’s value). Common attributes:AXValue- The displayed value
AXBusyIndicator
A loading spinner or activity indicator.Table and list elements
AXTable
A table with rows and columns. Common attributes:AXRows- Array of row elementsAXColumns- Array of column elementsAXVisibleRows- Currently visible rows
AXRow
A row within a table. Common attributes:AXIndex- Row indexAXSelected- Whether the row is selected
AXColumn
A column within a table. Common attributes:AXTitle- Column headerAXIndex- Column index
AXCell
A cell within a table. Common attributes:AXValue- Cell content
AXList
A list of items. Common attributes:AXChildren- List items
AXOutline
A hierarchical tree/outline view. Common attributes:AXRows- Outline rowsAXSelectedRows- Currently selected rows
Using roles effectively
Combine roles with other filters
Roles are most powerful when combined with title, label, or value filters:Interactive-only snapshots
Thesnapshot command can filter to only interactive roles:
- AXButton
- AXTextField
- AXTextArea
- AXCheckBox
- AXRadioButton
- AXPopUpButton
- AXComboBox
- AXSlider
- AXMenuButton
- AXLink
- AXTab
- AXMenuItem
- AXMenuBarItem
- AXSwitch
- AXToggle
- AXSearchField
- AXSecureTextField
- AXStepper
- AXDisclosureTriangle
- AXIncrementor
- AXColorWell
- AXSegmentedControl
Discover roles with tree and inspect
Use thetree command to see all roles in an application:
inspect to see all attributes of a specific element:
Common patterns
Finding buttons by text
Finding buttons by text
Filling text fields
Filling text fields
Toggling checkboxes
Toggling checkboxes
Selecting from dropdowns
Selecting from dropdowns
Reading static text
Reading static text