longPress
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Press and hold an element or a point — the gesture that opens context menus and starts drag-and-drop. These call app_long_press.
longPress
public void longPress(String target)
public void longPress(String target, Duration duration)
Presses and holds an element.
@param target a ref from map() such as "@e5", or a locator such as "text=Sign in"
Presses and holds an element for a given time.
@param target a ref from map() such as "@e5", or a locator such as "text=Sign in"
@param duration how long to hold
Examples
Press and hold for two seconds
device.longPress("@e4", Duration.ofSeconds(2));
On a device
| Before | After |
|---|---|
![]() | ![]() |
mobium long-press testid=pressTarget on an Android 15 emulator

