> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xenoci.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run and tap

> Keep the app open, read the screen, tap and type

> [!NOTE]
>
> **When to use it.** Your agent needs to reach a screen behind a tap, check a label or follow a flow. `box run` keeps the app open on an emulator; `box ui` drives it

## Open the app

```text theme={"system"}
$ box run --platform android
box: queue: job bj_Qnms8eghutSBvzEE (run, android, $0.02/min) submitted
box: live view: https://xenoci.com/live/bj_Qnms8eghutSBvzEE (sign in with this GitHub account; it closes when the session ends)
bj_Qnms8eghutSBvzEE
```

<video controls muted loop playsInline autoPlay preload="metadata" poster="/media/docs/android-run-poster.webp" src="https://mintcdn.com/xenoci/ZFKGlbE4Q2bw14Om/media/docs/android-run.mp4?fit=max&auto=format&n=ZFKGlbE4Q2bw14Om&q=85&s=beeebc5d1e0b2e1d9db9f4f20193ccd5" width="1280" height="778" />

box ui on an Android box run session: describe, tap Increment, then the screen showing Count 1

The live view link shows the emulator in your browser while the session is open

## Read the screen

```text theme={"system"}
$ box ui describe --platform android
box: queue: job bj_wamBRW8mDzPeqqVD (ui, android, $0.02/min) submitted
[box] waiting for the app session bj_dNZMc4UDgCTt9_4K to open (VM, build, simulator, launch; usually 1-4 minutes); this action runs in it then. Do not cancel the session.
[box] ui describe rc=0
box: bj_wamBRW8mDzPeqqVD succeeded, 0s billed, $0.00
…
android.widget.TextView "JetLagged"
android.widget.TextView "Sleep"
android.widget.TextView "Day"
android.widget.TextView "Week"
android.widget.TextView "Month"
android.widget.TextView "6M"
…
android.widget.TextView "AVE TIME IN BED"
android.widget.TextView "8h42min"
```

![JetLagged open on an Android emulator: the Sleep chart for the week](https://mintcdn.com/xenoci/ZFKGlbE4Q2bw14Om/images/docs-android-run.png?fit=max\&auto=format\&n=ZFKGlbE4Q2bw14Om\&q=85\&s=ffa89d011d44c7246cd4b3eab299e239)

## Tap and look

```text theme={"system"}
$ box ui tap --platform android --label Month
box: queue: job bj_oM0xWBt00WSw692G (ui, android, $0.02/min) submitted
[box] ui tap rc=0
[box] screenshot box-out/screen.png
box: results: saved to ./.box/out/bj_oM0xWBt00WSw692G/ (screen.png)
box: bj_oM0xWBt00WSw692G succeeded, 0s billed, $0.00
```

![JetLagged after box ui tap --label Month: the Month range is selected](https://mintcdn.com/xenoci/ZFKGlbE4Q2bw14Om/images/docs-android-tap.png?fit=max\&auto=format\&n=ZFKGlbE4Q2bw14Om\&q=85\&s=12c87aaac641f8ad038097402d6623e4)

The picture saved after the tap, made smaller for this page: Month is selected. Actions in an open session are not billed again; the session is billed from when it opens until `box stop`

## Every action

| Command | What it does |
| - | - |
| `box ui describe` | Every element on screen, one line each: class, label and the ref `tap --id` takes |
| `box ui find --text T` | The one element whose label or value contains T |
| `box ui tap --label T`, `--id REF` or `X Y` | Tap an element or a point |
| `box ui type TEXT` | Type into the focused field; single-line ASCII text on Android |
| `box ui swipe X1 Y1 X2 Y2` | Swipe from one point to another |
| `box ui button home` | Press a hardware button |
| `box ui screen out.png` | A picture of the screen now |

## Close it

```text theme={"system"}
$ box stop
bj_Qnms8eghutSBvzEE succeeded
```

`box debug` (LLDB breakpoints) is iOS only and exits 2 on Android


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.