> For the complete documentation index, see [llms.txt](https://docs.drizz.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.drizz.dev/writing-tests/tap/map-action.md).

# MAP\_ACTION

`MAP_ACTION` acts on the visible surface rather than on a labeled element. It covers maps, canvases and sliders, and applies when normal targeting has failed.

|                  |                                                          |
| ---------------- | -------------------------------------------------------- |
| **Platforms**    | <p>Tap   :  Android · iOS <br>Drag :  Android · iOS </p> |
| **Pinch / zoom** | Specific Android emulators only. Not iOS                 |

## Prerequisites

* A connected device or emulator
* An open test file
* A target element with no visible label and no clean bounding box, or a gesture that isn't a tap
* The surface fully rendered before the step runs

## Copy this

```
OPEN_APP com.shopease.android
Wait Until 5 Seconds

Tap on Filters
Wait Until 2 Seconds

MAP_ACTION Drag the price slider from 200 to 800
Validate that the price range shows 800
Tap on Apply
```

## Write a MAP\_ACTION step

1. Confirm the element has no visible label. If it has one, use [`Tap`](/writing-tests/tap.md).
2. Add a `Wait` above the step so the surface is fully rendered.
3. Start the line with `MAP_ACTION`, then describe the gesture in plain English.
4. State both ends of a drag — where it starts and where it ends.
5. Add a `Validate` on the next line for the resulting state.
6. Run the test several times and confirm the same cell resolves on each run.

## Syntax

| Element       | Form                                           | Notes                                                                                                         |
| ------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **Keyword**   | `MAP_ACTION`                                   | Space separator. `MAP_ACTION:` also works and appears in older scripts — write the space form in anything new |
| **Gesture**   | `Tap on <description>` · `Drag <from> to <to>` | The `/` palette lists two entries, `MAP_ACTION Tap` and `MAP_ACTION Drag`                                     |
| **Drag path** | `from <start> to <end>`                        | Both ends required                                                                                            |

```
MAP_ACTION Tap on the red location pin
MAP_ACTION Drag map pointer from left to right
```

## Tap

For map markers, canvas controls and boxes with no label of their own.

```
MAP_ACTION Tap on the red location pin
MAP_ACTION Tap on the map
MAP_ACTION Tap on the pickup marker near "Station"
MAP_ACTION Tap on the small white input box beside Rack / Conveyor 1 label
```

## Drag

For sliders, seekbars, time pickers, map panning and swipe-to-confirm controls. State where the drag starts and where it ends.

```
MAP_ACTION Drag map pointer from left to right
MAP_ACTION Drag from bottom to top
MAP_ACTION Drag from right to left to reposition marker
MAP_ACTION Drag from top to bottom to view surrounding region
MAP_ACTION Drag the price slider from 200 to 800
MAP_ACTION Drag the "hour picker" from 9 to 8
MAP_ACTION Drag up once on the left slider
MAP_ACTION Drag the green pin on the map from the store to the delivery address
```

Directional phrasing that works: *from left to right*, *from bottom to top*, *from top right to center of screen*.

## Pinch and zoom

```
MAP_ACTION pinch to zoom in twice
MAP_ACTION Perform a "pinch-to-zoom" gesture on the map
MAP_ACTION pinch to zoom in on object
```

{% hint style="warning" %}
Pinch and zoom are implemented for specific Android emulators only. They do not work on iOS, and they are not available on every device target. Tap and Drag work everywhere.
{% endhint %}

## Platform support

{% tabs %}
{% tab title="Android" %}

| Gesture      | Support                 | Notes                                           |
| ------------ | ----------------------- | ----------------------------------------------- |
| `Tap`        | ✅                       | Dispatches the same primitive as a normal tap   |
| `Drag`       | ✅                       | Dispatches the same primitive as a normal swipe |
| Pinch / zoom | Specific emulators only | Not available on every Android device target    |
| {% endtab %} |                         |                                                 |

{% tab title="iOS" %}

| Gesture       | Support | Notes                                                                    |
| ------------- | ------- | ------------------------------------------------------------------------ |
| `Tap`         | ✅       | Dispatches the same primitive as a normal tap                            |
| `Drag`        | ✅       | Dispatches the same primitive as a normal swipe                          |
| Pinch / zoom  | ❌       | Not implemented on iOS. Drop pinch from cross-platform tests, or gate it |
| {% endtab %}  |         |                                                                          |
| {% endtabs %} |         |                                                                          |

## Determinism

`MAP_ACTION` overlays a numbered grid on the screen and picks a cell. That is what lets it work where element targeting can't. Two runs of the same script can select different cells, most often when a tappable element straddles a grid boundary.

A `Validate` on the next line turns a wrong cell into a visible failure in the report instead of a failure three screens later.

```
MAP_ACTION Drag the price slider from 200 to 800
Validate that the price range shows 800
```

## Common mistakes

<table data-search="false"><thead><tr><th>What you wrote</th><th>What happens</th></tr></thead><tbody><tr><td><code>MAP_ACTION Tap on Continue</code> when <code>Continue</code> has a visible label</td><td>A deterministic tap replaced with a grid guess, for no benefit</td></tr><tr><td><code>MAP_ACTION Drag the slider</code> with no start and end</td><td>The drag has no defined path. State both ends</td></tr><tr><td><code>MAP_ACTION pinch to zoom in</code> in a suite that runs on iOS</td><td>The step doesn't run there. Gate it, or drop pinch from cross-platform tests</td></tr><tr><td>No <code>Validate</code> after a <code>MAP_ACTION</code></td><td>A wrong cell passes silently and the test fails somewhere unrelated</td></tr><tr><td><code>MAP_ACTION</code> on a normal list or form</td><td>Grid targeting on a screen that has a perfectly good element tree. Use <code>Tap</code> and <code>Scroll</code></td></tr><tr><td>A <code>MAP_ACTION</code> that worked once, trusted without a retry check</td><td>Repeat runs can pick a different cell. Run it several times before you rely on it</td></tr><tr><td><code>MAP_ACTION</code> issued while the map is still rendering</td><td>The grid is drawn over a half-loaded surface. Wait for the screen to settle first</td></tr></tbody></table>

## Next

* [Tap](/writing-tests/tap.md) — label-based targeting
* [Validate](/writing-tests/tap/validate.md) — what to put after a `MAP_ACTION`
* [Waits & timing](/writing-tests/waits-and-timing.md) — letting a map surface settle

***

*Last updated: 6 August 2026*
