October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Mountain View desk5 min

How to Write Android Tests with Appium

Set up Appium and UiAutomator2, choose an Android emulator or device, and run a small Python test against the Settings app.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To write an Android test with Appium, install the UiAutomator2 driver, connect Appium to an Android emulator or USB-debugged device, then use an Appium client to start a session, locate an element, interact with it, and end the session. This walkthrough uses Python and Appium’s built-in Android Settings app, so it does not require a separate test APK.

What you need before writing the test

  • Appium server: Install Appium and keep its server running while the test executes. The Appium CLI manages the server as well as drivers, plugins, and setup commands; see the Appium CLI reference.
  • Android SDK and Platform-Tools: Install the Android SDK Platform and Platform-Tools, and set ANDROID_HOME to your SDK directory. Platform-Tools supplies adb, which Appium uses to communicate with a target.
  • Java JDK: Install a JDK and set JAVA_HOME. The current UiAutomator2 setup guide specifies JDK 9 for the most recent Android API levels and JDK 8 otherwise. Check its live requirements for your Android and driver versions before setup, since these prerequisites can change: UiAutomator2 driver setup.
  • Android target: Use either an Android Virtual Device (AVD) or a physical device configured for development. You do not need to buy or own a phone to begin.
  • Python: This example uses Python and the official Appium-Python-Client. Appium also has official clients for Java, Ruby, and .NET; its ecosystem page lists integrations including WebdriverIO, Nightwatch.js, and Robot Framework: Appium ecosystem.

Choose an emulator or a physical device

Use an AVD

Create and start an Android Virtual Device in Android Studio’s Device Manager. An emulator is a practical first target when you do not need hardware-specific behavior. Once it is running, check that Android Debug Bridge can see it.

Use a physical Android device

On the device, enable Developer options and USB debugging, connect it to your computer, and accept the debugging authorization prompt. Then run:

adb devices

The device should appear in the output as a connected target. If it is shown as unauthorized, unlock the phone and approve the computer’s prompt; if it does not appear, check the cable, USB mode, debugging setting, and host drivers as applicable.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Yojaro 4Pack Silicone Suction Phone Case Mount, Silicon Adhesive Smartphones Stand Sticky, Hands-Free Phone Accessories Holder for Selfies and Videos (Black & White & Translucent & Light Pink)
  • 【Strong Adsorption】The inspiration of the silicone phone suction case comes from the adhesive force of the octopus. Each suction cup phone mount is 3.15 inches long and 2.17 inches wide, with 24 independent suction cups providing a stronger and more stable suction force, so you don't have to worry about your phone falling during use.
  • 【Back of Phone Suction Grip】Remove the adhesive film on the phone suction cup and stick it on the phone case. You can then fix the phone on any smooth surface, which is very convenient. (The phone suction cup cannot be removed and reused after being attached to the phone case. It is recommended to attach it to a regular phone case, not a valuable one.)
  • 【Widely Used】Our non-slip silicone phone sticky grip mount attaches to almost any flat phone case and make it compatible with common mobile phones such as iPhone and Android.You can shoot, watch videos or video calls in the kitchen, gym, dance studio, bathroom and other places.
  • 【Capture the Wonderful Picture】Whether you are a TikTok creator or just like to share videos and photos, this phone suction cup can help you hands-free capture wonderful videos and photos for sharing with friends.
  • 【Note】You can fix the phone suction cup on a smooth surface such as a mirror or glass. If necessary, wipe the suction cup with a damp cloth to obtain stronger suction. Before releasing your hand, make sure the phone is firmly fixed. (Not applicable to rough walls, wooden surfaces, and other uneven surfaces)

Install UiAutomator2 and verify prerequisites

Appium uses platform drivers to automate devices. UiAutomator2 is its official Android driver and supports native, hybrid, and web automation modes. Install it from a terminal:

appium driver install uiautomator2

Validate the Android setup with the driver’s doctor command:

Rank #2
Apple EarPods Headphones with USB-C Plug, Wired Ear Buds with Built-in Remote to Control Music, Phone Calls, and Volume
  • SUPERIOR COMFORT — Unlike traditional circular ear buds, the design of EarPods is defined by the geometry of the ear. Which makes them more comfortable for more people than any other ear bud–style headphones.
  • HIGH-QUALITY AUDIO — The speakers inside EarPods have been engineered to maximize sound output and minimize sound loss, which means you get high-quality audio.
  • BUILT-IN REMOTE — EarPods with USB-C plug also include a built-in remote that lets you adjust the volume, control the playback of music and video, and answer or end calls with a pinch of the cord.
  • COMPATIBILITY — Works with all devices that have a USB-C port.
  • INTEGRATED MICROPHONE — A built-in microphone precisely captures your voice while you’re on the phone, taking a FaceTime call, or summoning Siri — so you’re always heard loud and clear.
appium driver doctor uiautomator2

Resolve any reported missing prerequisites before starting the test. The session must select the driver with the UiAutomator2 automation name; the example below does that through Python options.

Install the Python client and write a first test

Install the official Python client in the same environment where you will run the test:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
PopSockets Adhesive Phone Grip, Holder- Black
  • Secure Hold: Our PopSockets adhesive phone grip gives your cell phone a secure, comfortable hold in hand to help prevent drops while texting, taking photos, or scrolling on the go. Designed to stick firmly to most phone cases and devices.
  • Hands-Free Made Easy: Easily turn your PopSocket into a phone stand to prop up your phone anywhere, perfect for watching videos, video calls, or following recipes. A must-have phone holder that keeps your device secure and ready for anything.
  • Compatibility: Works with all phones, tablets, and Kindles. Sticks best to smooth, hard plastic cases and may not adhere to silicone or textured cases. Easily swap your PopTop to change up your style.
  • Black PopSockets: Simple, refined, and endlessly versatile. A timeless essential for any phone.
  • Travel Must-Have for People On the Go: A must-have travel accessory for flights, flying, airports, air travel, airplanes, planes, international trips, cruises, and long travel days. Key gadget for your airport haul, travel accessories and must-haves.
python -m pip install Appium-Python-Client

Save this as test.py. It starts an Android session, opens the built-in Settings app, locates the “Apps” row by its visible text, clicks it, and always attempts to close the session:

from appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.common.appiumby import AppiumBy

options = UiAutomator2Options()
options.platform_name = "Android"
options.automation_name = "UiAutomator2"
options.app_package = "com.android.settings"
options.app_activity = ".Settings"

 driver = webdriver.Remote("http://localhost:4723", options=options)
try:
    apps_item = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "Apps")
    apps_item.click()
finally:
    driver.quit()

Remove the accidental leading space before driver = in the code above if copying into a Python file; the executable line should align with options =. The session capabilities identify Android, select UiAutomator2, and name the Settings package and activity. webdriver.Remote asks the Appium server to create the session. find_element locates the “Apps” item by accessibility ID, click() performs the action, and quit() releases the session even if a lookup or click fails. This follows the official Python quickstart.

Rank #4
360° Rotating Stainless Steel Phone Tether Tab (Silvery 3-Pack) - Universal for iPhone & Other Phones (Fits Wristbands/Necklaces/Crossbody Straps)
  • [360 ° Flexible Rotation Design] Comes with a rotatable lanyard ring that supports 360 ° free rotation, effectively solving the problem of twisted and tangled lanyards
  • [Wide compatibility] The ultra-thin 0.02-inch design does not block the charging port at all, and both wired and wireless charging can be used directly without removing the pad. Compatible with most smartphones such as iPhone, compatible with various wristbands, lanyards, crossbody straps, and keychains
  • [Durable and Portable Material] Premium rust-resistant stainless steel material with good flexibility, which not only avoids scratching the phone case, but also has excellent anti rust and anti fading performance
  • [Multi scenario Practical] Paired with a lanyard or wristband, hands-free use can be achieved. The phone is within reach and not easily dropped, ideal for daily commuting and outdoor activities. Suitable for full coverage phone cases, does not support half coverage phone cases
  • [Quality Service] If you find any damage or other issues with the product upon receipt, please contact us immediately. We will handle it quickly

Run the test

  1. Start the emulator or connect and authorize the physical device.
  2. In one terminal, start Appium with appium. The example connects to the default local server URL, http://localhost:4723.
  3. In another terminal, activate the Python environment where the client is installed and run python test.py.
  4. Watch the emulator or device: Appium should open Settings and navigate to Apps. If the test ends without an error, its session teardown has run.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Adapt the test to your Android app

For your own app, replace app_package and app_activity with the package and launch activity for the installed app. You can also provide an APK path through the session options when the test should install an app as part of session creation; consult the live UiAutomator2 and Python client documentation for the capability names supported by the versions you have installed.

Choose locators that reflect how the app is built and expose its UI. Accessibility IDs are generally a useful choice when the app provides stable accessibility labels; other Appium locator strategies are available through AppiumBy. Keep element lookup and actions explicit, and make assertions about the app’s expected state if turning this starter script into a test that reports pass or fail.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anteel 2 Pack Silicone Suction Cup Phone Case Mount Double Sided, Hands-Free Silicon Phone Grip with Higher Suction Power for Selfies and Videos, Non Slip Phone Accessories (LightPink&White)
  • 【PKYAA Double Sided Silicone Suction Phone Case Mount】PKYAA With Double Sided 40 Strong and Reliable individual suction cups, PKYAA provides a thicken and upgraded universal silicon suction mount for your phone.
  • 【Friendly to Content Creators】If you are a content creator or an online influencer, you can create videos anywhere with this suction mount completely hands free with this silicone cell phone mount for cases.
  • 【HANDS-FREE & Adhere to Mirrors】This Double Sided silicone suction phone case mount allows you to stick your phone to the mirror easily. No longer holding your phone in one hand to watch video tutorials while making up.
  • 【Strong Grip on the Smooth Surface】You can easily hang your phone anywhere with a smooth surface. All you do is you clean off your phone and smooth surface. It is STURDY and it not only sticks to mirrors, it also sticks to windows, it sticks to refrigerators, tiles and other clean, flat surfaces.
  • 【Press Down Firmly Every 30 Minutes】Use your palm or fingers to press the phone down firmly and check it's secure before letting go. Apply even pressure for a few seconds to allow the suction cup to adhere properly. To maintain the grip and prevent accidental falls, it's a good practice to periodically reapply pressure to the suction cup.

Troubleshooting a first Appium run

Symptom Likely cause What to check
Session creation says the UiAutomator2 driver is missing The driver is not installed in the Appium environment being used. Run appium driver install uiautomator2 with the same Appium installation that starts the server.
Driver doctor reports missing Android or Java dependencies The SDK, Platform-Tools, environment variables, or JDK setup is incomplete or incompatible. Check ANDROID_HOME, JAVA_HOME, and the current driver setup requirements; rerun appium driver doctor uiautomator2.
No device is available or session startup cannot find one The AVD is stopped, or a physical device is disconnected or not authorized. Start the AVD or run adb devices; resolve an unauthorized device on the phone.
The client cannot connect to the server Appium is not running, or the test URL does not match the server address. Start appium in a separate terminal and confirm the test uses http://localhost:4723 for that local server.
The Settings app opens but “Apps” is not found The current Settings interface may expose a different label or accessibility identifier. Inspect the screen and update the locator to match the target Android version and device interface; use Appium’s element-inspection tooling when needed.

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not an Android Appium runner, so it does not replace the device setup or interaction test above. It can capture a web page directly with one request when your task is a screenshot rather than Android UI automation. See the ScreenshotNeo website and API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
  • Cookie banners are accepted before capture, and known consent platforms, newsletter popups, and chat widgets are removed.
  • Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed; response headers report the page verdict and billing status.
  • An MCP server gives AI agents tools for screenshots, page information, and PDF capture.
  • The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Can I write an Appium Android test without a physical phone?

Yes. Appium’s UiAutomator2 setup supports an Android Virtual Device as well as a physical device.

Which programming languages can I use with Appium?

Official client libraries are available for Java, Python, Ruby, and .NET. The ecosystem also lists integrations such as WebdriverIO, Nightwatch.js, and Robot Framework.

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.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.