Skip to main content

drag

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

Drag and drop: press something, hold until it is picked up, carry it, and release. These call app_drag.

drag​

def drag(source: str, target: str, hold_ms: int | None=None) -> dict

Pick one element up, carry it onto another, and drop it.

Not swipe with two targets: a swipe has no hold at either end, so pointed at a reorderable row it scrolls the list instead of moving the row. Both ends are resolved from one snapshot before anything is touched.

hold_ms is how long the finger rests at each end, defaulting to 700 — above Android's 500ms long-press timeout, which is what a drag-to-reorder list arms on. Raise it first when a drag picks nothing up.

Reports that the gesture was delivered. Whether the drop was accepted is the app's own state, so call map() again to see it.

Examples​

Drag one element onto another​

device.drag("@e3", "@e7")

On a device​

BeforeAfter
Before: mobium drag 'label=Drag source' 'label=Drop zone' on an Android 15 emulatorAfter: mobium drag 'label=Drag source' 'label=Drop zone' on an Android 15 emulator

mobium drag 'label=Drag source' 'label=Drop zone' on an Android 15 emulator