Skip to main content

Drag · DragFor

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​

func (d *Device) Drag(ctx context.Context, from, to string) error

Drag picks one element up, carries it onto another, and drops 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.

What it reports is that the gesture was delivered. Whether the drop was accepted is the app's own state — call Map again to see it.

DragFor​

func (d *Device) DragFor(ctx context.Context, from, to string, hold time.Duration) error

DragFor is Drag with the hold at each end spelled out. Raise it first when a drag picks nothing up: the default is 700ms, above Android's 500ms long-press timeout, and some lists arm slower than that.

Examples​

Drag one element onto another​

if err := dev.Drag(ctx, "@e3", "@e7"); err != nil {
return err
}

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