# karagoz double-tap

Taps a point twice, or finds one node in the tree and taps its center twice.

Runs on

- Android emulator
- Android device
- iOS simulator
- iOS device

## Usage

```console title="~/app"
karagoz double-tap <x> <y> [--tree] [--device <id>]
karagoz double-tap --text <label> [--timeout <ms>] [--tree] [--device <id>]
karagoz double-tap --id <resource-id> [--timeout <ms>] [--tree] [--device <id>]
```

Give exactly one of `<x> <y>`, `--text` or `--id`. Nodes are found as in [`tap`](https://karagozmcp.com/docs/commands/tap/#how-a-node-is-found).

A double tap selects a word in a text field, or fires a double-tap gesture.

## Before you start

- On Android: the screen on and unlocked. With the screen off, or on the always-on display or a screensaver, nothing is sent and the command fails with [`DEVICE_NOT_READY`](https://karagozmcp.com/docs/error-codes/#device-not-ready).
- On Android, for `--text` and `--id`: no other UiAutomation client connected (Appium, Maestro, `uiautomator events`).
- On an iOS simulator: Xcode 27 or newer, opened once, or a Mac that never had Xcode 27, where the taps go through Karagöz’s runner.
- On an iPhone: paired with the Mac, Developer Mode on, connected by USB cable, Settings > Developer > Enable UI Automation on, and Karagöz’s runner installed with [`install-runner`](https://karagozmcp.com/docs/commands/install-runner/).

## Options

| Option               | Default                                                               | Meaning                                                                                                                     |
| -------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `<x> <y>`            |                                                                       | A point in [screen pixels](https://karagozmcp.com/docs/output/#coordinates). Non-negative, decimals allowed (`12`, `12.5`). |
| `--text <label>`     |                                                                       | A node whose `text` or `contentDesc` equals the label, as in `tap`.                                                         |
| `--id <resource-id>` |                                                                       | A node whose `resourceId` equals the value, or ends with `:id/<value>`, as in `tap`.                                        |
| `--timeout <ms>`     | `0`                                                                   | Keep reading the tree until a node matches or this much time has passed. Only with `--text` or `--id`.                      |
| `--tree`             | off                                                                   | Also return the [screen after the action](https://karagozmcp.com/docs/commands/ui-tree/#after-an-action) under `tree`.      |
| `--device <id>`      | see [Device selection](https://karagozmcp.com/docs/device-selection/) |                                                                                                                             |

## Examples

```console title="~/app"
$ karagoz double-tap 540 160
{"device":"emulator-5554","x":540,"y":160}
```

## Output

```json
{
  "device": "emulator-5554",
  "x": 540,
  "y": 160
}
```

The same fields as [`tap`](https://karagozmcp.com/docs/commands/tap/#output).

- `device` string: The adb serial, or the simulator's or iPhone's UDID.
- `x` number: Where the taps went, in [screen pixels](https://karagozmcp.com/docs/output/#coordinates): the point given, or the matched node's center.
- `y` number: Where the taps went, in screen pixels: the point given, or the matched node's center.
- `element` object: Only with `--text` or `--id`: the matched node, with the fields `tap` lists.
- `tree` object: Only with `--tree`: the compact tree after the action, `rotation` and `root` as [`ui-tree`](https://karagozmcp.com/docs/commands/ui-tree/#after-an-action) returns them.
- `treeError` object: Only with `--tree`, when that read failed: `code` and `message`. The action still ran.

## Timing

Each touch is held 50 ms, and the second starts 100 ms after the first lifts, on every target. Both touches come from one process, so nothing else sets the gap.

The window this fits: Android takes the second press 40-300 ms after the first lift and within 300 ms of the first press.

## Errors

| Code                                                                              | When                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`INVALID_ARGS`](https://karagozmcp.com/docs/error-codes/#invalid-args)           | No target or more than one (`'double-tap' takes <x> <y>, --text or --id`), a single coordinate (`'double-tap' needs <x> <y>`), `--timeout` with a point, or a malformed number.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [`HELPER_FAILED`](https://karagozmcp.com/docs/error-codes/#helper-failed)         | The input helper failed on the device, with its error in the message.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [`ELEMENT_NOT_FOUND`](https://karagozmcp.com/docs/error-codes/#element-not-found) | No node matches.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [`ELEMENT_AMBIGUOUS`](https://karagozmcp.com/docs/error-codes/#element-ambiguous) | More than one node matches.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [`ELEMENT_COVERED`](https://karagozmcp.com/docs/error-codes/#element-covered)     | The node's center is under the on-screen keyboard.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [`DEVICE_NOT_READY`](https://karagozmcp.com/docs/error-codes/#device-not-ready)   | The device is `offline`, `unauthorized` or similar, or the simulator is `Booting` or `Shutting Down`. For `tap`, `long-press`, `double-tap`, `swipe`, `text`, and `key` except `WAKEUP`, `SLEEP` and `POWER`: an Android screen that is off, on the always-on display or on a screensaver. For `tap`, `long-press`, `double-tap`, `swipe` and `key` right after a boot: the simulator's input service did not answer within 4 s. For `screenshot`: an iPhone that is not paired yet, has Developer Mode off, is no longer paired with this Mac, or is locked since it restarted. For `launch` and `open-url`: a locked iPhone. For `ui-tree`, `tap`, `long-press`, `double-tap`, `swipe`, `text` and `key`, also an iPhone not connected by USB cable, locked, or with a developer it does not trust yet. For those seven, also a runner that did not start within 60 s (look at the phone: the passcode sheet for UI automation, or Enable UI Automation off). Or something else answering on the runner's port without this Mac's key, or another app holding that port. On a simulator of a Mac that never had Xcode 27: a runner that did not start within 60 s, or a port another process took. For `logs`: an iPhone not connected by USB cable, one this Mac holds no pairing record for, or one that refuses this Mac's session. The message says what to do. |
| [`INPUT_BLOCKED`](https://karagozmcp.com/docs/error-codes/#input-blocked)         | The device does not let adb inject input. On Xiaomi, Redmi and POCO, "USB debugging (Security settings)" is off; on vivo and iQOO, "USB simulated click".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

Node taps also get every [`ui-tree` error](https://karagozmcp.com/docs/commands/ui-tree/#errors). Every double tap can also get the errors of its target, as for [`tap`](https://karagozmcp.com/docs/commands/tap/#errors).

## Notes

- On Android, Karagöz pushes its small helper to `/data/local/tmp`, runs it, and removes it in the same call. [`text`](https://karagozmcp.com/docs/commands/text/) does the same for text beyond ASCII.
- A call takes about 1.5-3.5 s on an emulator, most of it the helper’s start.
- Exit `0` means the device accepted the touches, not that the app reacted to them. Read the tree again to check.

## On an iOS simulator

Same arguments and output. The two touches go to the simulator’s own input service, as for [`tap`](https://karagozmcp.com/docs/commands/tap/#on-an-ios-simulator). On a Mac that never had Xcode 27 they go through Karagöz’s runner.

- The first of `ui-tree`, `tap`, `long-press`, `double-tap`, `swipe`, `text` or `key` on a simulator compiles a small [helper](https://karagozmcp.com/docs/requirements/#cache-folder), which takes a few seconds.
- [`NOT_SUPPORTED`](https://karagozmcp.com/docs/error-codes/#not-supported) with Xcode 26 or older on a Mac that once had Xcode 27.

## On an iPhone

Same arguments and output. Karagöz’s runner plays both touches in one event, as for [`tap`](https://karagozmcp.com/docs/commands/tap/#on-an-iphone).

**Run install-runner again after updating**

The runner changed with `double-tap`. After updating Karagöz to this version, run [`install-runner`](https://karagozmcp.com/docs/commands/install-runner/) again. Until then every call that needs the runner fails with [`RUNNER_NOT_INSTALLED`](https://karagozmcp.com/docs/error-codes/#runner-not-installed).

## MCP equivalent

MCP equivalent `double_tap {"x":540,"y":160}` [MCP tools](https://karagozmcp.com/docs/mcp/#tools)

Arguments: `x`, `y`, `text`, `id`, `timeout`, `device`. The names are the CLI's option and positional names.

## Related commands

- [karagoz ui-tree](https://karagozmcp.com/docs/commands/ui-tree/): Find the node to tap, and read the screen again after the taps.
- [karagoz tap](https://karagozmcp.com/docs/commands/tap/): Finds nodes the same way, and lists the fields and errors both share.
- [karagoz text](https://karagozmcp.com/docs/commands/text/): Pushes the same helper to the device, for text beyond ASCII.
- [karagoz install-runner](https://karagozmcp.com/docs/commands/install-runner/): Run it again on an iPhone after updating to the version with double-tap.
