For AI agents and LLMs: a machine-readable index is available at llms.txt. A plain-Markdown version of any documentation page is available by appending .md to its URL.
Skip to main content

Gesture Navigation on Android Real Devices

Real Device

By default, every Android real device on TestMu AI starts a session in 3-button navigation (the Back, Home and Recents bar). Set the navigationMode capability to gesture to switch the device to gesture navigation for that session. The device goes back to its original navigation mode when the session ends.

Use Cases​

  • Test flows that rely on system gestures, such as a swipe from the left or right screen edge to go back.
  • Check edge-to-edge layouts without the 3-button bar taking up screen space.
  • Verify that in-app swipes near the screen edges do not clash with system gestures.

Supported Platforms​

ItemSupport
PlatformAndroid real devices only
Android versionAndroid 10 and above
Device makesGoogle Pixel and Samsung Galaxy (phones and tablets)
Session typesAppium app automation and Appium browser automation on real devices
Not supported
  • iOS: session creation fails. See Errors.
  • Android 9 and below: these versions have no system gesture navigation. The session starts and runs in 3-button navigation.
  • Other device makes (Xiaomi, OnePlus, Motorola, Vivo, Oppo and others): the capability is ignored and the session runs in 3-button navigation.
  • Virtual devices (emulators): the capability is ignored.
  • Manual (Live) real device sessions: there is no navigation mode option.

Enabling Gesture Navigation via Capabilities​

Add the navigationMode capability inside lt:options:

{
"lt:options": {
"platformName": "android",
"deviceName": "Galaxy S24",
"platformVersion": "14",
"isRealMobile": true,
"app": "YOUR_APP_URL",
"navigationMode": "gesture"
}
}
CapabilityTypeAccepted valueDefault
navigationModeStringgesture (case-insensitive)Not set: 3-button navigation
info
  • There is no threeButton value. To run in 3-button navigation, leave the capability out.
  • For browser automation, replace the app capability with browserName.
  • You can generate capabilities for your test requirements with the help of our inbuilt Capabilities Generator tool. For more details, please refer to our guide on Desired Capabilities in Appium.

What Changes in Gesture Mode​

  • A swipe inward from the left or right edge is the system Back action.
  • A swipe up from the bottom edge goes Home. Swipe up and hold opens Recents.
  • The 3-button bar is replaced by a thin gesture handle, so the app gets more screen height. Screenshots and video recordings show this layout.
  • pressKeycode(4) (the Back key) works as before, in both modes.
  • App swipes that start exactly at a screen edge can be taken by the system as Back or Home. Start such swipes a little inside the edge if you do not want the system gesture.

The example below performs an edge swipe that triggers Back in gesture mode, using UiAutomator2:

driver.executeScript("mobile: swipeGesture", Map.of(
"left", 0, "top", 1100, "width", 600, "height", 100,
"direction", "right", "percent", 0.75, "speed", 2500));

Errors​

CaseResult
Any value other than gestureSession creation fails with HTTP 400: The capability navigationMode has value <x> which is not supported. Supported values are [gesture]
Used with a non-Android platformSession creation fails with HTTP 400: navigationMode capability is not supported with <platform> platform
Unsupported device make, Android 9 or below, or virtual deviceNo error. The session runs in 3-button navigation.

Terminal First Testing With Kane CLI

Natural language browser & mobile app tests right from terminal.

×
Schedule Your Personal Demo
Kane CLI terminal

Help and Support

Related Articles