true or false based on the element’s current state from the last snapshot.
Usage
Parameters
Element reference ID from a previous snapshot (e.g.,
@e1, @e2, @e14).State property to check.Options:
visible- Element is visible (not hidden)enabled- Element is enabled (not disabled)checked- Element is checked (checkboxes, radio buttons, toggles)focused- Element has keyboard focusexpanded- Element is expanded (disclosure triangles, tree items, comboboxes)
Response
Name of the state property that was checked.
Reference ID that was queried.
Whether the state is true or false.
Whether this state property is applicable to the element’s role. For example,
checked is only applicable to checkboxes, radio buttons, and toggles.Examples
Check if button is enabled
Check if checkbox is checked
Check if element is visible (default)
Check if element is focused
Check if disclosure is expanded
Check inapplicable state
Error Cases
Stale ref
Element not found
State Logic
visible
Returnsfalse if the element has the hidden state, otherwise true.
- Applicable to: All elements
enabled
Returnsfalse if the element has the disabled state, otherwise true.
- Applicable to: All elements
checked
Returnstrue if the element has the checked state, otherwise false.
- Applicable to:
checkbox,switch,radiobutton,togglebutton,menuitemcheckbox,menuitemradio
focused
Returnstrue if the element has the focused state, otherwise false.
- Applicable to: All elements
expanded
Returnstrue if the element has the expanded state, otherwise false.
- Applicable to:
disclosuretriangle,treeitem,combobox,popupbutton,outline,row
Notes
- States are read from the last snapshot’s RefMap, not re-queried from the accessibility API.
- The command uses optimistic re-identification to verify the element still exists, but the state values themselves are from the cached snapshot.
- To ensure fresh state information, run
snapshotbefore callingis. - The
applicablefield indicates whether the property makes sense for the element’s role. For example,checkedis not applicable to buttons. - If a state is not applicable,
resultwill befalsebutapplicablewill also befalse.