appium_gesture
Automate mobile app touch gestures for testing—tap, double-tap, long-press, scroll, swipe, pinch-zoom, scroll-to-element, and back. Supports coordinates or elements.
Instructions
Perform a touch gesture. Use 'action' to choose: tap, double_tap, long_press, scroll, swipe, pinch_zoom, scroll_to_element, back. Choose scroll vs swipe by intent: scroll to browse content in a list or feed; swipe to dismiss, switch screens, navigate carousels, or pull-to-refresh (speed=fast). For drag-and-drop use appium_drag_and_drop. For custom multi-touch use appium_perform_actions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | X coordinate. For tap/double_tap/long_press: tap location (alternative to elementUUID). For scroll/swipe: starting X for custom-coordinate mode (requires y, endX, endY). For pinch_zoom: center X of the pinch. Requires y. Ignored if elementUUID is set. | |
| y | No | Y coordinate. For tap/double_tap/long_press: tap location. For scroll/swipe: starting Y for custom-coordinate mode. For pinch_zoom: center Y of the pinch. Requires x. Ignored if elementUUID is set. | |
| endX | No | Ending X coordinate. Used by: scroll, swipe (custom-coordinate mode). | |
| endY | No | Ending Y coordinate. Used by: scroll, swipe (custom-coordinate mode). | |
| scale | No | Pinch scale factor. < 1 = zoom out (pinch close), > 1 = zoom in (pinch open). Example: 0.5 = zoom out 50%, 2.0 = zoom in 2x. Required for: pinch_zoom. | |
| speed | No | Swipe speed. slow = deliberate drag; normal = default navigation speed; fast = flick with no hold, use for pull-to-refresh and other velocity-sensitive UIs. Used by: swipe. | |
| action | Yes | Gesture to perform. tap: tap an element or a coordinate. double_tap: trigger a double-tap action (e.g. zoom in on an image, favorite a post). long_press: press and hold to open a context menu or initiate drag. scroll: browse a list, feed, or page to reveal content. swipe: dismiss a card, switch screens or tabs, navigate a carousel, or pull-to-refresh (use speed=fast). pinch_zoom: zoom in (scale > 1) or out (scale < 1) on maps, images, or any zoomable view. scroll_to_element: scroll until a specific element is on screen (strategy + selector + direction up|down). Stops when the element is found, page source is unchanged after a scroll (end of scrollable content), or maxScrollAttempts is reached. Optional scrollDistance (0.05–1) or scrollDistancePreset (small|medium|large). back: triggers the system back navigation (e.g., Android back button or iOS navigation controller pop). | |
| duration | No | Duration in milliseconds. long_press default 2000 (range 500-10000). scroll default 800. For swipe, prefer the speed parameter; duration overrides it if both are provided. | |
| selector | No | Locator selector value. Required for: scroll_to_element. | |
| strategy | No | Locator strategy. Required for: scroll_to_element. Priority: accessibility id > id > platform-native (-ios predicate string / -ios class chain on iOS, -android uiautomator on Android) > xpath (LAST RESORT — slow on iOS XCUITest, brittle) > name > class name > css selector (webview only). Same ranking as appium_find_element. | |
| velocity | No | Pinch velocity in scale factor per second. Default 2.2. Used by: pinch_zoom. | |
| direction | No | Direction for scroll or swipe. Coordinates are auto-calculated from screen or element bounds. Either direction OR custom coordinates (x, y, endX, endY) must be provided for these actions. | |
| sessionId | No | Session ID to target. If omitted, uses the active session. | |
| elementUUID | No | UUID of the element to act on. Used by: tap, double_tap, long_press, pinch_zoom. For scroll/swipe, when provided with direction, the gesture is calculated relative to this element instead of the whole screen. | |
| scrollDistance | No | scroll_to_element only: vertical swipe length as a fraction 0.05–1 (same scale as legacy scroll). Ignored when scrollDistancePreset is set. Default 0.45 if neither preset nor scrollDistance is set. | |
| maxScrollAttempts | No | scroll_to_element only: maximum scroll attempts after the element is not yet visible (default 10). | |
| scrollDistancePreset | No | scroll_to_element only: convenience preset — small ≈ light nudge (0.25), medium ≈ 0.45, large = full default swipe (1). When set, overrides scrollDistance. |