flowdeck ui simulator.
Common Flags
Most UI automation commands support:-S, --simulatorto target a specific simulator by name or UDID. Recommended when multiple simulators are booted. Examples:-S "iPhone 16"or-S "A1B2C3D4-...".- For AI agent workflows, always pass
-Sexplicitly on everyflowdeck ui simulator ...command. - If
-Sis omitted, FlowDeck falls back to session/default simulator selection. This is usually fine when only one simulator is booted (common in CI). --json,-jfor machine-readable output.--verbose,-vand--examples,-eon commands that support extra output.
Capture
| Command | Purpose | Key Options |
|---|---|---|
ui simulator screen | Screenshot + accessibility tree | --tree, --optimize, --output |
ui simulator record | Record simulator video | --duration, --codec, --force, --output |
ui simulator session start | Start background tree + screenshot capture | -S, --interval-ms, --retention-seconds |
ui simulator session stop | Stop the active capture session | -S |
Query
| Command | Purpose | Key Options |
|---|---|---|
ui simulator find | Locate elements by label/ID/role | --by-id, --by-role, --contains |
Interaction
| Command | Purpose | Key Options |
|---|---|---|
ui simulator tap | Tap element or coordinates | --point, --duration, --by-id |
ui simulator double-tap | Double tap element or coordinates | --point, --by-id |
ui simulator type | Type into focused field | --clear, --mask |
ui simulator swipe | Swipe by direction or coordinates | --from, --to, --duration, --distance |
ui simulator scroll | Scroll content (gentler than swipe) | --direction, --speed, --distance, --until, --timeout |
ui simulator pinch | Pinch to zoom in/out | in/out, --scale, --point, --duration |
ui simulator rotate | Rotate with a two-finger gesture | <degrees>, --point, --radius, --duration |
ui simulator back | Navigate back (edge swipe) |
Wait and Assert
| Command | Purpose | Key Options |
|---|---|---|
ui simulator wait | Wait for element state | --timeout, --poll, --gone, --enabled, --stable |
ui simulator assert visible | Assert element is visible | --by-id |
ui simulator assert hidden | Assert element is hidden | --by-id |
ui simulator assert enabled | Assert element is enabled | --by-id |
ui simulator assert disabled | Assert element is disabled | --by-id |
ui simulator assert text | Assert element text | --expected, --contains, --by-id |
Input and Keyboard
| Command | Purpose | Key Options |
|---|---|---|
ui simulator erase | Erase text from focused field | --characters |
ui simulator hide-keyboard | Hide the on-screen keyboard | |
ui simulator key | Send keyboard keycodes | --sequence, --hold |
App Control
| Command | Purpose | Key Options |
|---|---|---|
ui simulator open-url | Open a URL or deep link | |
ui simulator clear-state | Clear app data/state |
Hardware
| Command | Purpose | Key Options |
|---|---|---|
ui simulator button | Press hardware buttons | home, lock, siri, applepay, volumeup, volumedown, --hold |
ui simulator set-appearance | Set light or dark mode | light, dark |
Advanced
| Command | Purpose | Key Options |
|---|---|---|
ui simulator touch down | Touch down at coordinates | x,y, -S |
ui simulator touch up | Touch up at coordinates | x,y, -S |
Key Options Explained
Screen and Record
--outputuses a file path. Screenshots default to a.png, recordings to a.mov. If omitted, FlowDeck writes to a temp file and prints the path.--treereturns only the accessibility tree (no screenshot data).--optimizeshrinks the screenshot output for AI workflows.screenreports size in points; JSON includespoint_width/point_heightandpixel_width/pixel_heightwhen available.--durationis in seconds (supports decimals like2.5).--codecacceptsh264orhevc.--forceoverwrites an existing output file.
Sessions
- Always pass
-S <name-or-udid>onsession startandsession stopto target a specific simulator. Accepts a simulator name (e.g.,"iPhone 16") or raw UDID. This is required when multiple simulators are booted and recommended in all automation workflows. session startcaptures tree + screenshots every 500ms by default and writes to./.flowdeck/automation/sessions/<session-short-id>/(the short ID is the first 8 characters of the session UUID).- Starting a session stops any active session first and requires a booted simulator.
--interval-msand--retention-secondstune capture frequency and retention (default 60s). Retention always keeps at least one capture.- Sessions capture screenshots on each interval; entries are written only when the tree or screenshot changes and screenshots are stored only when pixel content changes (JPEG at 50% quality).
latest.jsonpoints to the most recent capture,latest.jpgsymlinks to the latest screenshot, andlatest-tree.jsonsymlinks to the latest accessibility tree (no directory listing required).- JSON output from
session startincludes full paths for the session directory, screens, trees, latest pointers, the UDID, and the current screen size in points (screen). session stopends the active session and cleans up captured data. When-Sis provided, it resolves the name to a UDID and verifies the active session matches before stopping (returns an error on mismatch). JSON output includes the stopped session’s UDID.- Sessions also end automatically if the simulator disappears.
Find, Tap, and Double-Tap
--by-idmatches accessibility identifiers instead of labels.--by-rolematches element roles (e.g.button,textField).--containsdoes a substring match against labels.--pointexpectsx,ycoordinates in points (matches normalized screenshots and tree output).- Do not scale by @2x/@3x or device resolution; use the image coordinates directly.
- Coordinate taps use the provided point exactly; use label/ID taps to target element centers.
--geometryacceptspointsonly.- Session screenshots are normalized to point size so image coordinates map 1:1 to points.
--durationontapis a long-press hold time in seconds.
Swipe and Scroll
swipesupports directionsup,down,left,rightor explicit--from x,y+--to x,y.--durationforswipeis in seconds (default0.3).--distancesets swipe/scroll distance as a fraction of the screen (0.05–0.95), not pixels or points. Defaults: swipe0.4, scroll0.2.- Example:
--distance 0.25scrolls 25% of the screen height. - Invalid:
--distance 300(FlowDeck will reject values outside 0.05–0.95).
- Example:
--directionforscrollusesUP,DOWN,LEFT, orRIGHT(defaultDOWN).--speedis a 0-100 value (higher is faster).--untilscrolls until an element is visible. Useid:myElementto match by accessibility identifier.--timeoutforscroll --untilis in milliseconds.
Pinch and Wait
pinchuses a direction argument:in(zoom out) orout(zoom in).--scaleoverrides the zoom factor (defaults to2.0forout,0.5forin).--pointexpectsx,ycoordinates in points for the pinch center.--geometryacceptspointsonly.--durationforpinchis in seconds.--timeoutforwaitis in seconds;--pollis in milliseconds.--gone,--enabled, and--stablechange the wait condition (default is “exists”).
Text, Key, and App Control
type --clearclears the focused field before typing.type --maskhides typed text in terminal output and JSON.erase --characters 5deletes a specific number of characters; omit to clear all.key 40sends a single HID keycode (for example,40= Enter).key --sequence 11,8,15sends comma-separated HID keycodes.key --hold 1.0holds a single key for the given seconds.open-urlacceptshttps://...or custom schemes likemyapp://path.clear-staterequires a bundle identifier (for examplecom.example.app) and resets the simulator container for that app.rotateperforms a two-finger rotation gesture (degrees, optional center/radius).
Set Appearance
set-appearanceacceptslightordarkto switch the simulator’s appearance mode.- If
-Sis omitted, the booted simulator is used. - JSON output includes the applied appearance and target UDID.
Buttons and Touch
button --hold 1.5holds a hardware button for the given seconds.touch downandtouch upexpectx,ycoordinates in points.- Do not scale by @2x/@3x or device resolution; use the image coordinates directly.
--geometryacceptspointsonly.
Performance and Reliability Tips
- Start a session before any UI work. Run
flowdeck ui simulator session start -S <name-or-udid> --json, parse the JSON output to getlatest_screenshotandlatest_treefile paths, then use Read tool on those paths to see the screen and inspect elements. - Verify after every action. After each tap/type/swipe, wait ~1 second, then re-read
latest_screenshotto confirm the UI changed. Never chain actions without checking. - Use accessibility identifiers and
--by-idwhenever possible; label matching is slower and more ambiguous. - Before tapping an element, read
latest_treeto confirm it exists and is visible. - For automation loops, re-read
latest-tree.json/latest.jpgfrom disk instead of issuingscreenfor every step. The session updates these files automatically. - For one-off tree-only checks, use
ui simulator screen --tree --json -S <name-or-udid>(no screenshot). Use--optimizewhen you do need a one-off screenshot. - Use
scroll --until "id:yourElement"to bring off-screen targets into view before tapping. - Increase
--pollfor slow UIs to reduce load; decrease when you need faster detection. - Tune input timing with environment variables:
FLOWDECK_HID_STABILIZATION_MS(default 25) for tap/gesture stabilityFLOWDECK_TYPE_DELAY_MS(default 20) for typing speed
flowdeck ui simulator --help.