AgentConstants
InterfaceAccessibility action constants for use with performAction()
These constants represent Android accessibility actions that can be performed on UI nodes. Use them with the node.performAction() method.
Usage Example
TypeScript
// Click a node using accessibility actionconst screen = await agent.actions.screenContent();const button = screen.findTextOne("Submit");
if (button) { await button.performAction(agent.constants.ACTION_CLICK);}
// Set text on an input fieldconst input = screen.findAdvanced(f => f.isEditText());if (input) { await input.performAction( agent.constants.ACTION_SET_TEXT, { [agent.constants.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE]: "Hello World" } );}Action Constants
Basic Actions
| Constant | Value | Description |
|---|---|---|
ACTION_FOCUS | 1 | Set focus on the node |
ACTION_CLEAR_FOCUS | 2 | Clear focus from the node |
ACTION_SELECT | 4 | Select the node |
ACTION_CLEAR_SELECTION | 8 | Clear selection from the node |
ACTION_CLICK | 16 | Perform a click action on the node |
ACTION_LONG_CLICK | 32 | Perform a long click action on the node |
ACTION_ACCESSIBILITY_FOCUS | 64 | Set accessibility focus |
ACTION_CLEAR_ACCESSIBILITY_FOCUS | 128 | Clear accessibility focus |
Navigation Actions
| Constant | Value | Description |
|---|---|---|
ACTION_NEXT_AT_MOVEMENT_GRANULARITY | 256 | Move to next element at given granularity |
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY | 512 | Move to previous element at given granularity |
ACTION_NEXT_HTML_ELEMENT | 1024 | Navigate to next HTML element |
ACTION_PREVIOUS_HTML_ELEMENT | 2048 | Navigate to previous HTML element |
Scroll Actions
| Constant | Value | Description |
|---|---|---|
ACTION_SCROLL_FORWARD | 4096 | Scroll forward (down or right) |
ACTION_SCROLL_BACKWARD | 8192 | Scroll backward (up or left) |
ACTION_SCROLL_UP | 16908344 | Scroll up |
ACTION_SCROLL_DOWN | 16908346 | Scroll down |
ACTION_SCROLL_LEFT | 16908345 | Scroll left |
ACTION_SCROLL_RIGHT | 16908347 | Scroll right |
ACTION_SCROLL_TO_POSITION | 16908343 | Scroll to a specific position |
ACTION_SCROLL_IN_DIRECTION | 1000072 | Scroll in a specific direction |
ACTION_PAGE_UP | 16908358 | Page up |
ACTION_PAGE_DOWN | 16908359 | Page down |
ACTION_PAGE_LEFT | 16908360 | Page left |
ACTION_PAGE_RIGHT | 16908361 | Page right |
Editing Actions
| Constant | Value | Description |
|---|---|---|
ACTION_CUT | 65536 | Cut text to clipboard |
ACTION_COPY | 16384 | Copy text to clipboard |
ACTION_PASTE | 32768 | Paste text from clipboard |
ACTION_SET_SELECTION | 131072 | Set text selection range |
ACTION_SET_TEXT | 2097152 | Set the text content |
Expand/Collapse Actions
| Constant | Value | Description |
|---|---|---|
ACTION_EXPAND | 262144 | Expand a collapsible node |
ACTION_COLLAPSE | 524288 | Collapse an expanded node |
ACTION_DISMISS | 1048576 | Dismiss/close a dismissable node |
Advanced Actions
| Constant | Value | Description |
|---|---|---|
ACTION_SHOW_ON_SCREEN | 16908342 | Scroll to make the node visible |
ACTION_SET_PROGRESS | 16908349 | Set progress value (e.g., SeekBar) |
ACTION_CONTEXT_CLICK | 16908348 | Perform context click (right-click) |
ACTION_SHOW_TOOLTIP | 16908356 | Show tooltip |
ACTION_HIDE_TOOLTIP | 16908357 | Hide tooltip |
ACTION_PRESS_AND_HOLD | 16908362 | Press and hold the node |
ACTION_IME_ENTER | 16908372 | Submit via IME enter key |
ACTION_SHOW_TEXT_SUGGESTIONS | 16908376 | Show text suggestions |
ACTION_MOVE_WINDOW | 16908354 | Move a window |
Drag Actions
| Constant | Value | Description |
|---|---|---|
ACTION_DRAG_START | 16908373 | Start a drag operation |
ACTION_DRAG_DROP | 16908374 | Drop at current position |
ACTION_DRAG_CANCEL | 1690837 | Cancel the drag operation |
Argument Constants
These constants are used as keys in the data parameter of performAction() to pass additional arguments.
| Constant | Value | Description |
|---|---|---|
ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT | "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT" | Movement granularity for navigation |
ACTION_ARGUMENT_HTML_ELEMENT_STRING | "ACTION_ARGUMENT_HTML_ELEMENT_STRING" | HTML element type for navigation |
ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN | "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN" | Whether to extend selection |
ACTION_ARGUMENT_SELECTION_START_INT | "ACTION_ARGUMENT_SELECTION_START_INT" | Selection start position |
ACTION_ARGUMENT_SELECTION_END_INT | "ACTION_ARGUMENT_SELECTION_END_INT" | Selection end position |
ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE | "ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE" | Text to set |
ACTION_ARGUMENT_MOVE_WINDOW_X | "ACTION_ARGUMENT_MOVE_WINDOW_X" | Window X position |
ACTION_ARGUMENT_MOVE_WINDOW_Y | "ACTION_ARGUMENT_MOVE_WINDOW_Y" | Window Y position |
ACTION_ARGUMENT_ACCESSIBLE_CLICKABLE_SPAN | "android.view.accessibility.action.ACTION_ARGUMENT_ACCESSIBLE_CLICKABLE_SPAN" | Clickable span reference |
ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT | "android.view.accessibility.action.ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT" | Press and hold duration in ms |
ARGUMENT_DIRECTION_INT | "android.view.accessibility.action.ARGUMENT_DIRECTION_INT" | Direction for scroll operations |
ARGUMENT_SCROLL_AMOUNT_FLOAT | "android.view.accessibility.action.ARGUMENT_SCROLL_AMOUNT_FLOAT" | Scroll amount/distance |