For Android gesture tests, start an Appium session with the UiAutomator2 driver and use its mobile: gesture extensions for taps, long presses, swipes, scrolling, pinches, and flings. Use W3C Actions when a gesture needs a custom pointer sequence. iOS uses Appium’s separate XCUITest stack, so do not copy UiAutomator2 gesture commands into an iOS test.
What you need before writing a gesture test
Appium automation has three moving parts: the Appium server, a platform driver with its dependencies, and a client library. Your test client creates a session and sends commands through it. For the Android examples below, that driver is UiAutomator2. Install Appium, install the driver and its dependencies, install a client, then run a script against your app or a sample app; see the Appium quickstart.
The official Python quickstart shows the session lifecycle using UiAutomator2Options, Android capabilities, element lookup, a click, and session teardown. A click in that example is not a gesture-specific sample, but the same session setup pattern applies to gesture tests. Appium’s client ecosystem includes official Python, Java, Ruby, and .NET clients, plus third-party options such as WebdriverIO. A W3C WebDriver-compatible client may work generally, but some Appium-specific commands may not be implemented by every client.
Use the client and driver that match the platform
- For Android shortcut commands in this guide, install and use UiAutomator2, and check its documentation for the version you have installed.
- For iOS, use the XCUITest driver and its Xcode, WebDriverAgent, and platform dependencies. The exact gesture calls are not covered here because current XCUITest gesture syntax has not been established by the sources cited in this article.
Run an Android gesture test with UiAutomator2
UiAutomator2 provides driver-specific high-level commands for common gestures: mobile: longClickGesture, mobile: doubleClickGesture, mobile: clickGesture, mobile: dragGesture, mobile: pinchOpenGesture, mobile: pinchCloseGesture, mobile: swipeGesture, mobile: scrollGesture, and mobile: flingGesture. In Python, the typical form is driver.execute_script('mobile: commandName', { ... }). The precise client method signature can vary, so consult the chosen client and the UiAutomator2 driver documentation.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Complete Python example: scroll, assert, and stop safely
This example creates a session, locates a scroll container, scrolls down until the driver reports no more content or a test limit is reached, checks for an app-specific destination element, and always attempts to end the session. Replace the app identifier, device name, and selectors with values for your app and test device.
from appium import webdriver
from appium.options.android import UiAutomator2Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
options = UiAutomator2Options()
options.platform_name = "Android"
options.automation_name = "UiAutomator2"
options.device_name = "Android Emulator"
options.app_package = "com.example.app"
options.app_activity = ".MainActivity"
# Start the Appium server before running this script.
driver = webdriver.Remote("http://127.0.0.1:4723", options=options)
try:
wait = WebDriverWait(driver, 15)
scroll_area = wait.until(
EC.presence_of_element_located((By.ID, "com.example.app:id/list"))
)
found = False
max_swipes = 12 # Test-design guard against an unbounded loop.
for _ in range(max_swipes):
matches = driver.find_elements(
By.ID, "com.example.app:id/destination"
)
if matches:
found = True
break
can_scroll_more = driver.execute_script(
"mobile: scrollGesture",
{
"elementId": scroll_area.id,
"direction": "down",
"percent": 0.75,
},
)
if not can_scroll_more:
break
assert found, "Expected destination item was not visible after scrolling"
finally:
driver.quit()
The returned boolean from scrollGesture indicates whether the object can still scroll in the requested direction. The loop limit is a test-design safeguard, not a driver requirement. The assertion checks an app-visible result; successful execution of a gesture command alone does not prove the app behaved correctly.
Choosing a target and defining the movement
When a command supports an element identifier, target the element or container that represents the intended interaction. For area-based scroll, swipe, or pinch commands, provide left, top, width, and height to bound the gesture region. For scroll and swipe, provide a direction and a percent; scrollGesture accepts up, down, left, and right, and its percent must be greater than zero. A percent of 1.0 represents 100% of the area. Speed is configurable where the command supports it. Consult the driver guide for the exact arguments and defaults for each gesture.
Prefer a semantic element target when supported: coordinates and screen bounds are more sensitive to layout and device dimensions. When a region is necessary, keep it close to the actual scrollable or gesture area and make the bounds part of the test’s intent. For example, a swipe intended to dismiss a card should be constrained to that card rather than an unexplained portion of the whole screen.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Command selection by test intent
| Test intent | UiAutomator2 command | Useful inputs or behavior |
|---|---|---|
| Tap or double-tap | mobile: clickGesture or mobile: doubleClickGesture |
Use the documented element or coordinate form. The driver describes clickGesture as a possible workaround when a native tap fails despite apparently correct coordinates; it is not a universal replacement for element clicks. |
| Press and hold | mobile: longClickGesture |
Supports an element or coordinates and a duration in milliseconds; the documented default duration is 500 ms. |
| Move an element | mobile: dragGesture |
Choose the documented element or coordinate/bounds form for the drag scenario. |
| Zoom in or out | mobile: pinchOpenGesture or mobile: pinchCloseGesture |
Use the target element or bounded area supported by the command. |
| Move across a region | mobile: swipeGesture |
Specify direction and percent for the area form; speed is configurable in the driver API. |
| Move content through a scrollable region | mobile: scrollGesture |
Specify direction and percent; the result reports whether more scrolling is possible in that direction. |
| Flick content quickly | mobile: flingGesture |
Use the command’s documented target and movement arguments for the installed driver version. |
The driver also documents a separate mobile: scroll extension that seeks a selector. Use that when the intent is to locate a particular element; use mobile: scrollGesture when the test should perform a directional scroll and use its can-scroll result. See the UiAutomator2 command documentation for current parameters.
When to use W3C Actions instead
Use a high-level UiAutomator2 gesture shortcut when it expresses the behavior directly: scroll a container, long-press a target, or pinch an area. The driver recommends W3C Actions for more complicated input. Actions are a better fit when the scenario needs a custom sequence of pointer movements or timing rather than one standard semantic gesture. They are W3C-level input actions, but that does not make the UiAutomator2 mobile: shortcuts cross-platform commands.
| Approach | Best fit | Trade-off |
|---|---|---|
| UiAutomator2 gesture extension | A standard Android gesture with a supported target or region and documented parameters. | Concise and intent-specific, but driver-specific; check command availability and arguments for the installed UiAutomator2 version. |
| W3C Actions | A custom or multi-step pointer sequence where the path and timing need explicit control. | More control over the input sequence, but requires a more detailed action definition and remains subject to the platform driver’s input support. |
The UiAutomator2 driver README points to W3C Actions and lower-level Android input information for complicated gestures. Use the W3C WebDriver Actions specification alongside your client’s documentation when building a custom sequence.
Keep the test about the app’s result
- Wait for the screen or target state that must exist before the gesture; do not rely on arbitrary delays when an observable condition is available.
- After the gesture, assert a visible label, changed value, destination element, or other app-specific result. A command returning without error is not an assertion of business behavior.
- Record the target, region, direction, percent, speed, and duration where relevant so another engineer can understand what the test is exercising.
- Repeat the scenario across the Android devices and OS versions your project supports. Device differences can affect coordinates and timing; no particular reliability rate is implied here.
- Bound repeated scrolling with both a condition and a maximum number of attempts so a failed or unexpectedly long list cannot run forever.
iOS requires its own gesture path
Appium’s iOS automation stack is different: the client communicates through Appium and the XCUITest driver, which manages WebDriverAgent and depends on Xcode, XCUITest, iOS, and macOS. That separation helps narrow failures: a problem may be in test code, Appium, the driver, Apple’s tooling, or the device or simulator. See the Appium driver architecture guide and the XCUITest driver documentation.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallRank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Do not use Android’s mobile: scrollGesture or other UiAutomator2 extensions as iOS instructions. The older Appium swipe tutorial is archived and does not establish current XCUITest command syntax. Verify the current XCUITest driver and client documentation before writing an exact iOS gesture call; this article does not assert a specific iOS gesture API or version requirement. The historical platform overview is available in the archived Appium swipe tutorial.
Troubleshooting gesture tests
The gesture command is unknown or rejected
Likely cause: the command is a UiAutomator2 extension but the session uses another driver, or the installed driver version and command documentation do not match. Fix: confirm the active session’s platform and automation name, check the installed UiAutomator2 version, and use that version’s driver documentation. Also verify that your client supports Appium-specific execute-script commands.
A tap misses even though the coordinates look right
Likely cause: coordinate input is sensitive to viewport size, layout, or the element’s current position. Fix: use an element target where possible. If the native tap call fails despite apparently correct coordinates, UiAutomator2 documents mobile: clickGesture as a possible driver-specific workaround. Check the result on the actual device configuration rather than assuming the workaround is universal.
A scroll runs but the expected item is never found
Likely cause: the test is scrolling the wrong container, using the wrong direction, or asserting a selector that does not identify the displayed item. Fix: target the intended container, validate the direction and bounds, and assert the visible app state after each relevant movement. Use mobile: scroll when you want to seek a selector; use mobile: scrollGesture when you want a directional gesture and its can-scroll result.
Recommended Free Tools
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
A gesture behaves differently across devices
Likely cause: coordinate regions or timing do not correspond to the same UI area across layouts or device sizes. Fix: prefer elements for supported operations, constrain area-based gestures to the intended container, and set explicit speed or duration when the command supports it. Run the scenario against the device and OS combinations you support.
The test passes the command but fails to verify the interaction
Likely cause: the test treats command completion as proof of app behavior. Fix: wait for and assert an observable post-gesture state, such as a destination item, changed value, or updated label.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
For website screenshots used in a gesture-testing workflow, ScreenshotNeo provides a one-request screenshot API; it does not replace Appium for interacting with a mobile app. Its capture flow accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; those steps can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. It also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents.
Example cURL request (replace the target URL and supply your API key):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. The same request can be made in Python:
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Or in Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo returns a PNG, JPEG, WebP, or PDF. It has a free allowance of 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 screenshots. See ScreenshotNeo for details, or sign up free.
Frequently Asked Questions
Does Appium automatically verify that a gesture worked?
No. A successful command does not establish the app’s intended result; the test must assert an observable UI state.
Can I use UiAutomator2 gesture extensions for iOS?
No. They are UiAutomator2 driver-specific commands. Use the XCUITest driver’s current documentation for iOS.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

