In Appium, which driver ships mobile: swipeGesture and which ships mobile: swipe?
answer
- no shared gesture vocabulary
- check the driver, not the platform
- UiAutomator2 suffixes its gesture names
- XCUITest and Espresso share one spelling
basics
~10 sAppium's UiAutomator2 driver on Android ships mobile: swipeGesture; the XCUITest driver on Apple platforms ships mobile: swipe. The names are not shared, so a helper written for one driver fails outright on the other.
solid answer
~40 sNamed gesture commands are declared per driver, so the vocabulary changes with the driver rather than with the operating system. On Android, Appium's UiAutomator2 driver declares `mobile: swipeGesture`, alongside `mobile: flingGesture`, `mobile: pinchOpenGesture`, `mobile: pinchCloseGesture`, `mobile: dragGesture`, `mobile: clickGesture` and `mobile: longClickGesture`. On Apple platforms the XCUITest driver declares a different set — `mobile: swipe`, `mobile: touchAndHold`, `mobile: forcePress`, `mobile: pinch`, `mobile: tap` and `mobile: dragFromToForDuration`. Both are sent the same way, as a `mobile:` name plus one parameter map over `POST /session/:sessionId/execute/sync`, but neither driver answers the other's names: post `mobile: swipeGesture` to an XCUITest session and it fails as an unknown execute method, not as a weak swipe. Appium's Espresso driver, though an Android driver, follows XCUITest and calls its command `mobile: swipe`.
go deeper
Recall the pair: Appium's UiAutomator2 driver names the Android swipe mobile: swipeGesture and the XCUITest driver names the Apple one mobile: swipe. Be ready to say that neither driver answers the other's name.
Explain why the names diverge. Gesture shortcuts are per-driver execute methods declared in each driver's own map, sent over execute/sync, with no normalising layer in the Appium server to translate between them.
Show how you catch this before it reaches a suite. Read the server log for the rejected script name, confirm which driver the session actually started with, and keep the name mapping in one reviewed place instead of scattering it.
Own the position that gesture calls are driver-scoped, not platform-scoped. Set the team convention for where the per-driver mapping lives and how a gesture with no counterpart is surfaced rather than quietly approximated.
## Where a gesture command comes from Appium speaks the W3C WebDriver protocol, and that protocol was written for browsers. It has a click, a send-keys and a low-level pointer API, but no vocabulary at all for a fling, a pinch or a pressure-sensitive press. Everything a driver offers beyond the standard set is exposed as an **execute method**: a script name of the form `mobile: <name>` plus a single parameter map, posted to `POST /session/:sessionId/execute/sync`. Gesture shortcuts are the largest family of these on the mobile drivers, because each platform's own UI-testing engine already knows how to inject those inputs natively and the driver only has to expose them. The structural consequence is the whole of this topic: **an execute method belongs to a driver, not to Appium**. There is no catalogue that every driver must implement, and no normalising layer in the server. Each driver declares its own execute-method map, and a name outside that map is not a command for that session. ## The two vocabularies | Gesture | Android — UiAutomator2 driver | Apple platforms — XCUITest driver | |---|---|---| | Swipe | `mobile: swipeGesture` | `mobile: swipe` | | Tap | `mobile: clickGesture` | `mobile: tap` | | Long press | `mobile: longClickGesture` | `mobile: touchAndHold` | | Double tap | `mobile: doubleClickGesture` | `mobile: doubleTap` | | Drag | `mobile: dragGesture` | `mobile: dragFromToForDuration` | | Pinch | `mobile: pinchOpenGesture` / `mobile: pinchCloseGesture` | `mobile: pinch` | | Momentum throw | `mobile: flingGesture` | no command of that name | | Pressure press | no command of that name | `mobile: forcePress` | Not one row shares a spelling. There is a visible pattern — UiAutomator2 suffixes its gesture names with `Gesture` and XCUITest does not — but it is a pattern, not a rule you can apply blindly. XCUITest also ships `mobile: tapWithNumberOfTaps`, `mobile: twoFingerTap`, `mobile: rotateElement`, `mobile: selectPickerWheelValue` and `mobile: rotateDigitalCrown`, none of which has an Android twin under any name. ## The split follows the driver, not the operating system It is tempting to file this as "Android says one thing, iOS says another". That reading breaks on Appium's Espresso driver, which is an Android driver and yet names its swipe `mobile: swipe`, exactly as XCUITest does. Appium's Android drivers are not one driver: UiAutomator2 and Espresso are separate extensions chosen by `appium:automationName`, and the gesture map you get is the one the chosen driver declares. So the honest rule is: - The command name is a property of the **driver**, not of the platform. - Two sessions on the same Android phone can want different gesture names. - `platformName` is therefore the wrong key to branch a shared helper on. - The only reliable source is what the driver in play declares. ## What the wrong name actually does Suppose a mountain-hut reservation suite scrolls its list of huts by posting `mobile: swipeGesture`. On a UiAutomator2 session the list moves. Point the same helper at an XCUITest session and the step does not degrade into a shorter or slower swipe — the driver has no execute method registered under that name, so the `execute/sync` call comes back as a failure and the step dies immediately. That is a mercy, not a nuisance: a silent no-op would let an assertion pass over a screen that never scrolled. The symmetric mistake is worse, because it reads as correct. Writing "UiAutomator2's `mobile: swipe`" pairs two real identifiers and is still false; no spell-check and no identifier search can catch it, and a reader who copies it spends an afternoon hunting a command their driver never had. Attribute every gesture to its driver by name, every time. ## Reading a gesture call in review When a `mobile:` gesture turns up in a diff, four questions settle whether it is right: 1. Which driver did this session start with, and does that driver declare this name? 2. If the helper is shared, where does it branch, and does the branch key survive an Espresso session? 3. Does this gesture have a counterpart on the other driver at all, or is it platform-only code? 4. Are the arguments the ones this driver's command takes, or the other driver's arguments in disguise? ## Why it is worth knowing at the first tier This is the cheapest piece of Appium knowledge on the interaction surface and it saves the most time. Someone who knows only that the names diverge will look the right one up. Someone who believes Appium normalises gestures will write a shared helper, watch it fail on one platform, and reach for a retry or a sleep to fix something that is not intermittent at all. The failure is deterministic, and its cause is spelled out in the command name itself.
- Which Appium driver besides XCUITest answers mobile: swipe, and why does that matter?The Espresso driver, which is an Android driver, also declares mobile: swipe. That is why the split is per driver rather than per platform: an Android session answers mobile: swipeGesture or mobile: swipe depending on which automationName started it. Branch a shared helper on the driver in play, never on platformName alone.
- What does an Appium session do with a mobile: name the driver does not declare?It fails the command rather than ignoring it. The driver has no execute method registered under that name, so the execute/sync call comes back as an error for that session and the step stops there. You see an immediately failing step, not a gesture that quietly did nothing.
saying these in an interview costs you the question
- Says Appium defines one cross-platform gesture command set.
- Sends mobile: swipeGesture to an XCUITest session and expects it to work.
- Attributes mobile: swipe to the UiAutomator2 driver.
- Thinks the divergence is Android versus iOS rather than driver versus driver.
- Assumes an unknown mobile: name is silently ignored by the driver.