Skip to main content

Tap · TapPoint · DoubleTap · DoubleTapPoint · TapFingers

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Tap an element. These call app_tap.

Tap​

func (d *Device) Tap(ctx context.Context, target string) error

Tap taps a ref ("@e5") or a locator ("text=Sign In").

The element is re-resolved immediately before the tap, and the tap scrolls to it first if it is below the fold.

TapPoint​

func (d *Device) TapPoint(ctx context.Context, x, y int) error

TapPoint taps a point in device pixels.

DoubleTap​

func (d *Device) DoubleTap(ctx context.Context, target string) error

DoubleTap taps an element twice, close enough together that the platform reads one gesture rather than two taps.

The same tool as Tap with one argument set, so the target is resolved the same way and refused the same way when the screen has moved. The uiautomator dump driver refuses it: nothing there controls the interval.

DoubleTapPoint​

func (d *Device) DoubleTapPoint(ctx context.Context, x, y int) error

DoubleTapPoint double-taps a point in device pixels.

TapFingers​

func (d *Device) TapFingers(ctx context.Context, target string, fingers int) error

TapFingers taps an element with several fingers at once, side by side — a two-finger tap with 2, a three-finger tap with 3 (up to 5). On iOS three fingers can reach the system instead of the app: three-finger gestures are undo, redo, copy and paste there.

Examples​

Tap an element by its visible text​

if err := dev.Tap(ctx, "text=Network & internet"); err != nil {
return err
}

The same call from the command line, mobium tap "text=Network & internet", printed on an Android 15 emulator:

tapped text=Network & internet at (407, 867)
BeforeAfter
Before: mobium tap "text=Network & internet" on an Android 15 emulatorAfter: mobium tap "text=Network & internet" on an Android 15 emulator

mobium tap "text=Network & internet" on an Android 15 emulator

Tap a ref from the last map​

if err := dev.Tap(ctx, "@e2"); err != nil {
return err
}

Double-tap​

if err := dev.DoubleTap(ctx, "@e2"); err != nil {
return err
}

Tap right after work the screen does not show, with the gray box on​

if err := dev.LaunchWithGrayBox(ctx, "dev.mobium.mobiumapp"); err != nil {
return err
}
if err := dev.Tap(ctx, "testid=busyQuiet"); err != nil {
return err
}
// Waits for the app to say it is idle.
if err := dev.Tap(ctx, "testid=busyRowB"); err != nil {
return err
}

The same call from the command line, mobium tap testid=busyRowB, printed on an Android 15 emulator:

tapped testid=busyRowB at (540, 1095)
gray box: waited 307 ms for the app to go idle (busy: quiet)

mobium tap testid=busyRowB on MobiumApp's Busy Demo, Android 15 emulator, launched with --gray-box: the tap waited for the quiet refresh to finish, and Row B is the new generation's

mobium tap testid=busyRowB on MobiumApp's Busy Demo, Android 15 emulator, launched with --gray-box: the tap waited for the quiet refresh to finish, and Row B is the new generation's

On a device​

BeforeAfter
Before: mobium double-tap testid=pressTarget on an Android 15 emulatorAfter: mobium double-tap testid=pressTarget on an Android 15 emulator

mobium double-tap testid=pressTarget on an Android 15 emulator