Touch & Gesture Actions
Touch and gesture actions for mobile and desktop interactions. Touch actions generate native touch events with humanized timing. Pointer actions (right-click, long-press) use trusted CDP input.
right_click
Right-clicks (context menu click) on an element using trusted pointer input. Scrolls the element into view first.
| Param | Type | Description |
|---|---|---|
| selectorrequired | string | array | CSS selector for the target element. |
| indexoptional | number | Which visible match to click (0 = first). Default: 0. |
| timeoutoptional | number | Max time to wait for element in ms. Default: 8000. |
{ "type": "right_click", "selector": ".file-row" }
{ "type": "right_click", "selector": "#context-target", "timeout": 5000 }long_press
Long-presses an element — pointer down, hold for a duration, then pointer up. Used for context menus on mobile, drag initiation, or any interaction that requires a sustained press.
| Param | Type | Description |
|---|---|---|
| selectorrequired | string | array | CSS selector for the target element. |
| durationoptional | number | Hold duration in ms. Default: 600. Alias: hold. |
| indexoptional | number | Which visible match to press (0 = first). Default: 0. |
| timeoutoptional | number | Max time to wait for element in ms. Default: 8000. |
{ "type": "long_press", "selector": ".menu-item", "duration": 800 }
{ "type": "long_press", "selector": "#draggable", "hold": 1000 }touch_drag
Touch drag gesture — simulates a finger pressing down at one point, dragging to another, and lifting. The drag path is broken into discrete steps for natural movement.
| Param | Type | Description |
|---|---|---|
| fromXrequired | number | Start X coordinate (viewport pixels). Alias: from_x. |
| fromYrequired | number | Start Y coordinate (viewport pixels). Alias: from_y. |
| toXrequired | number | End X coordinate. Alias: to_x. |
| toYrequired | number | End Y coordinate. Alias: to_y. |
| stepsoptional | number | Number of intermediate touch-move events. Default: 20. |
| durationoptional | number | Total drag duration in ms. Default: 400. |
// Drag slider handle to the right
{
"type": "touch_drag",
"fromX": 100, "fromY": 300,
"toX": 350, "toY": 300,
"steps": 25, "duration": 500
}
151
{
"type": "touch_drag",
"fromX": 200, "fromY": 500,
"toX": 200, "toY": 150
}swipe
Directional swipe gesture. Swipes from the center of the viewport in the given direction. Speed and distance control how the gesture feels.
| Param | Type | Description |
|---|---|---|
| directionrequired | string | "up", "down", "left", or "right". Default: "left". |
| distanceoptional | number | Swipe distance in pixels. Default: 200. |
| speedoptional | number | Swipe speed in ms (lower = faster). Default: 400. |
{ "type": "swipe", "direction": "left", "distance": 250 }
{ "type": "swipe", "direction": "up", "distance": 400, "speed": 300 }
{ "type": "swipe", "direction": "right" }Use Cases
- Range sliders —
touch_dragfrom handle to target position - Map navigation —
touch_dragto pan,swipefor quick directional moves - Carousel/gallery —
swipeleft/right to browse items - Pull-to-refresh —
swipedown from top of page - Context menus —
long_presson mobile,right_clickon desktop