Overview
Sets an element’s value directly using the accessibility API (kAXValueAttribute). This is faster than typing and bypasses keyboard events, making it ideal for bulk text entry or filling fields that don’t require keystroke validation.
Syntax
Parameters
Element reference from snapshot (
@e1, @e2, etc.)Value to set (no length limit)
Response
Response Fields
The action performed (
set_value)The element reference that was updated
Element state after setting value
role(string): Element rolevalue(string): New element valuestates(string[]): Current states
AX-First Strategy
The set-value command:- Sets
kAXValueAttributedirectly via accessibility API - Falls back to
clear+typeif AX set fails - Returns updated element state
Usage Examples
Set Text Field Value
Fill Large Text Area
Update Slider Value
Batch Form Fill
Supported Element Types
| Role | Value Type | Example |
|---|---|---|
textfield | String | Email, password, search |
textarea | String | Multi-line text |
slider | Numeric string | ”50”, “75” |
combobox | String | Selected option |
incrementor | Numeric string | Stepper value |
Set-Value vs Type
| Aspect | set-value | type |
|---|---|---|
| Speed | Fast (instant) | Slower (char-by-char) |
| Keyboard events | Not triggered | Triggered |
| Validation | May be skipped | Triggers on keypress |
| Autocomplete | Won’t trigger | Will trigger |
| Max length | Unlimited | 10,000 chars |
| Use case | Bulk data entry | User simulation |
set-value when:
- Filling large text areas
- No validation on keypress
- Speed is priority
- Keyboard events not required
type when:
- Autocomplete must trigger
- Validation happens on keypress
- Simulating real user typing
- Keyboard shortcuts should fire
Error Cases
| Error Code | Cause | Recovery |
|---|---|---|
ELEMENT_NOT_FOUND | Ref doesn’t exist in current refmap | Run snapshot to refresh |
STALE_REF | Element no longer matches saved ref | Run snapshot and use new ref |
ACTION_FAILED | Element doesn’t support value attribute | Try type or clear + type |
ACTION_NOT_SUPPORTED | Element type doesn’t accept values | Wrong element type |
Notes
- Replaces existing value completely (not append)
- No length limit (unlike
typewith 10K limit) - Does not trigger keyboard events (
keydown,keyup) - Does not move cursor or trigger autocomplete
- May not work with custom input components
- Always verify value was set by reading it back if critical
- For password fields, some apps may block AX value reads