API: UI Interaction
Tools for simulating user interactions like tapping, typing, and swiping within the iOS simulator.
ui_tap
Simulates a tap on the screen in the iOS Simulator at a specified coordinate.
Parameters
Name | Type | Required | Description |
---|---|---|---|
x |
number |
Yes | The x-coordinate for the tap. |
y |
number |
Yes | The y-coordinate for the tap. |
udid |
string |
No | UDID of the target simulator. If omitted, the booted simulator is used. |
duration |
string |
No | Press duration in seconds (e.g., "0.5" ). Simulates a long press. |
Returns
A text message confirming the tap was successful.
ui_type
Inputs text into the focused element in the iOS Simulator.
Parameters
Name | Type | Required | Description |
---|---|---|---|
text |
string |
Yes | The text to input. Must be ASCII printable characters ([\x20-\x7E]+ ). |
udid |
string |
No | UDID of the target simulator. If omitted, the booted simulator is used. |
The text
has a maximum length of 500 characters.
Returns
A text message confirming the text was typed successfully.
ui_swipe
Simulates a swipe gesture on the screen in the iOS Simulator.
Parameters
Name | Type | Required | Description |
---|---|---|---|
x_start |
number |
Yes | The starting x-coordinate of the swipe. |
y_start |
number |
Yes | The starting y-coordinate of the swipe. |
x_end |
number |
Yes | The ending x-coordinate of the swipe. |
y_end |
number |
Yes | The ending y-coordinate of the swipe. |
udid |
string |
No | UDID of the target simulator. If omitted, the booted simulator is used. |
delta |
number |
No | The size of each step in the swipe. Defaults to 1 . |
Returns
A text message confirming the swipe was successful.