appium_gesture
Perform touch gestures such as tap, double tap, long press, scroll, swipe, pinch zoom, and back navigation to automate Android and iOS app interactions.
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 pixel coordinate, paired with y: tap location, pinch center, or scroll/swipe start (requires endX/endY). elementUUID overrides x/y for tap/double_tap/long_press/pinch_zoom. | |
| y | No | Y pixel coordinate, paired with x; same action meanings and elementUUID precedence as x. | |
| endX | No | Ending X coordinate in pixels for scroll/swipe; requires x, y, endY. | |
| endY | No | Ending Y coordinate in pixels for scroll/swipe; requires x, y, endX. | |
| scale | No | Required for pinch_zoom: <1 zooms out, >1 zooms in (e.g. 0.5 or 2 for 2x). | |
| speed | No | Swipe only. slow: deliberate drag; normal: default navigation speed; fast: flick without an initial hold. Use fast for pull-to-refresh and other velocity-sensitive interfaces. | |
| action | Yes | tap/double_tap/long_press: requires elementUUID or both x/y. scroll/swipe: requires direction or x/y/endX/endY. pinch_zoom: requires scale (<1 out, >1 in). scroll_to_element: requires strategy/selector; direction up/down (default down). Stops on a match, unchanged page source, or maxScrollAttempts. Adjust distance with scrollDistance or scrollDistancePreset. back: system back navigation. | |
| duration | No | Duration in milliseconds. long_press defaults to 2000 (range 500–10000); scroll defaults to 800. For swipe, prefer speed unless a custom movement duration is needed. For W3C swipe, overrides movement time; speed still sets the initial hold. Ignored by iOS native mobile: swipe (direction, no elementUUID, speed != fast). | |
| selector | No | Locator selector value. Required for: scroll_to_element. | |
| strategy | No | Required for scroll_to_element. Prefer accessibility id > id > platform-native (iOS: -ios predicate string / -ios class chain; Android: -android uiautomator) > xpath (last resort: slow/brittle). name is legacy; class name may match multiple elements; css selector is webview-only. Same priorities 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/swipe. Coordinates are calculated from the screen or element bounds. Provide either direction or custom coordinates (x, y, endX, endY); direction takes precedence if both are given. For scroll_to_element, use up/down; default down. | |
| sessionId | No | Session ID; defaults to the active session. | |
| elementUUID | No | Element UUID for tap, double_tap, long_press, or pinch_zoom; overrides x/y for these actions. For scroll/swipe with direction, coordinates are calculated relative to this element instead of the whole screen. | |
| scrollDistance | No | scroll_to_element only: vertical swipe distance fraction (0.05–1). Ignored when scrollDistancePreset is set. Default 0.45 when neither option is supplied. | |
| maxScrollAttempts | No | scroll_to_element only: maximum scroll attempts after the initial lookup fails. Default 10. | |
| scrollDistancePreset | No | scroll_to_element only: small is a light nudge (0.25), medium is 0.45, large is the full default swipe (1). Overrides scrollDistance when set. |