# tap

> Tap a point in the screenshot, a @t ref from look, or a line of text found on screen.

Source: https://zeptap.com/docs/cli/commands/tap



## Usage [#usage]

```sh
zeptap tap <x> <y> [--expect <text>]
zeptap tap @tN
zeptap tap --text <text> [--index <n>] [--exact]
```

## Options [#options]

| Option            | Description                                                                                       |
| ----------------- | ------------------------------------------------------------------------------------------------- |
| `<x> <y>`         | Whole pixels in the latest screenshot, origin top-left                                            |
| `@tN`             | A ref from the last [`look`](https://zeptap.com/docs/cli/commands/look). Checked against the screen before tapping       |
| `--text <text>`   | Find the line on screen and tap its center: an exact match first, then a line containing the text |
| `--index <n>`     | When several lines match `--text`, tap the nth (1-based, top to bottom)                           |
| `--exact`         | With `--text`, only accept a whole-line match                                                     |
| `--expect <text>` | With `<x> <y>`, refuse the tap unless this text is at the point                                   |

Also takes the [global options](https://zeptap.com/docs/cli#global-options), including `--look`.

## Details [#details]

* After the tap, the command waits for the screen to settle, prints the target, and saves a screenshot.
* Prefer a ref or `--text` to estimated coordinates: OCR finds the label's exact center.
* A ref whose text moved a little taps the new spot. A ref whose text went away is refused with exit code 3. Run `look` again.
* When `--text` matches several lines, nothing is tapped. The command lists the matches with fresh refs and exits with code 2: pass `--index` or one of the refs.
* `--expect` is for taps where a miss would post, send or delete. A refused tap exits with code 3 and lists where the text was seen.
* A tap on a button that pays or places an order waits until the user approves it on the Mac. If they don't, nothing is tapped.

## Examples [#examples]

```sh
$ zeptap tap -l 7 @t4 --look
$ zeptap tap -l 7 --text "Next"
$ zeptap tap -l 7 --text "Follow" --index 2
$ zeptap tap -l 7 412 1188
$ zeptap tap -l 7 540 1210 --expect "Send"
```

## MCP tool [#mcp-tool]

[`tap`](https://zeptap.com/docs/agents/tools#tap), and [`tap_text`](https://zeptap.com/docs/agents/tools#tap_text) for `--text`.
