Getting Started with Appium – A Beginner’s Guide

Asset 69
Getting started with Appium for mobile testing. Beginner guide to mobile app automation testing framework.

Getting started with Appium 3 - mobile automation testing guide

2 Platforms (iOS + Android)
W3C WebDriver protocol
OSS Open source

What is Appium?

Appium is an open-source automation framework for testing mobile applications. It supports native apps (built for iOS or Android), mobile web apps (accessed through a browser), and hybrid apps (web content wrapped in a native container).

What makes Appium useful is cross-platform support. You write tests using the W3C WebDriver protocol, and Appium translates those commands into platform-specific actions. One test framework can cover both iOS and Android.

Appium 3 vs Appium 2

Appium 3 was released in August 2025 with important updates. If you are starting fresh, use Appium 3:

  • Node.js 20+ required - minimum Node v20.19.0 or v22.12.0+ (up from Node 14 in Appium 2)
  • Driver-based architecture - install only the platform drivers you need (UiAutomator2 for Android, XCUITest for iOS)
  • Scoped feature flags - --allow-insecure now requires scope prefixes
  • New session discovery - GET /appium/sessions replaces GET /sessions
  • Express 5 - updated underlying server framework

Migration from Appium 2 to 3 is simpler than 1 to 2. The examples in this guide are for Appium 3.

Prerequisites

For Android testing:

  • Node.js 20+ and npm 10+ (required for Appium 3)
  • Java Development Kit (JDK) 17+ (LTS recommended)
  • Android Studio with Android SDK
  • ANDROID_HOME and JAVA_HOME environment variables set
  • At least one Android emulator or physical device with USB debugging enabled

For iOS testing (macOS only):

  • Node.js 20+ and npm 10+ (required for Appium 3)
  • Xcode 15+ with command-line tools
  • At least one iOS simulator or physical device

Installation

Terminal
# Install Appium 3 globally (requires Node 20+)
npm install -g appium

# Install the Android driver
appium driver install uiautomator2

# Install the iOS driver (macOS only)
appium driver install xcuitest

# Verify installation
appium driver list --installed

Run appium in a terminal to start the server. You should see output confirming the server is running on http://127.0.0.1:4723.

Verifying your setup

Appium provides a doctor command that checks your environment:

Terminal
# Install the doctor plugin
appium plugin install --source=npm appium-doctor

# Check Android setup
npx appium-doctor --android

# Check iOS setup
npx appium-doctor --ios

Fix any issues it reports before proceeding.

Writing your first test

Here is a minimal test that opens an app and interacts with it. This example uses JavaScript with WebDriverIO, the most popular Appium client.

Terminal
# Create a project
mkdir appium-demo && cd appium-demo
npm init -y
npm install webdriverio

Create a file called test.js:

test.js
const { remote } = require('webdriverio');

async function main() {
  const driver = await remote({
    hostname: '127.0.0.1',
    port: 4723,
    capabilities: {
      platformName: 'Android',
      'appium:automationName': 'UiAutomator2',
      'appium:app': '/path/to/your/app.apk',
    }
  });

  // Wait for the app to load
  await driver.pause(2000);

  // Find an element and interact with it
  const element = await driver.$('~search_button');
  await element.click();

  // Verify something
  const searchField = await driver.$('~search_src_text');
  const isDisplayed = await searchField.isDisplayed();
  console.log('Search field visible:', isDisplayed);

  await driver.deleteSession();
}

main().catch(console.error);

Run it while Appium server and an emulator are active:

Terminal
node test.js

Key Appium concepts

Desired capabilities

Desired capabilities tell Appium what device and app to use:

Capability Purpose Example
platformName Target OS Android or iOS
appium:automationName Driver to use UiAutomator2 or XCUITest
appium:app Path to APK/IPA /path/to/app.apk
appium:deviceName Device or emulator Pixel_7_API_34
appium:platformVersion OS version 14.0

Locator strategies

Strategy Notes
accessibility id Best option - works cross-platform
id Android resource ID (e.g., com.app:id/button)
xpath Powerful but slow and fragile - use as last resort
class name Element type (e.g., android.widget.Button)
-android uiautomator Android-specific UiSelector queries
-ios predicate string iOS-specific NSPredicate queries

Appium Inspector

Appium Inspector is a GUI tool that helps you find elements in your app. It shows the app's element tree and lets you try different locator strategies before writing code.

Install it from github.com/appium/appium-inspector. Connect to your running Appium server, start a session, and click on elements to see their properties.

This is the fastest way to build reliable selectors for your tests.

Best practices

Use accessibility IDs as your primary locator

They are stable, fast, and work on both iOS and Android. Ask developers to add contentDescription (Android) and accessibilityIdentifier (iOS) to testable elements.

Keep tests independent

Each test should start from a clean state. Use driver.resetApp() or reinstall the app between tests to avoid state leakage.

Handle waits explicitly

Mobile apps are slow. Use explicit waits (driver.waitUntil) instead of fixed pauses. Fixed pauses make tests slow and flaky.

Run on real devices for final validation

Emulators and simulators are fast for development, but they miss real-world issues like Bluetooth, camera, GPS, and performance on lower-end hardware.

Common issues and fixes

Troubleshooting

  • "Could not find adb" - your ANDROID_HOME is not set correctly. Add it to your shell profile.
  • Session creation timeout - the emulator is not fully booted. Wait for the home screen before starting the test.
  • Element not found - the element has not loaded yet. Add an explicit wait, or the locator strategy is wrong. Use Appium Inspector to verify.
  • Tests pass on emulator but fail on device - real devices have different performance characteristics. Add longer waits and check for device-specific UI differences.

Next steps

  1. Set up a test framework (WebDriverIO with Mocha, or Pytest with Appium-Python-Client)
  2. Organize tests by feature using the page object pattern
  3. Add your tests to CI/CD (GitHub Actions, Jenkins, or GitLab CI)
  4. Expand to cover your most critical user flows

For teams that need help building mobile automation from scratch, BetterQA's automation engineers design and maintain Appium test suites for iOS and Android across industries from fintech to healthcare.

Talk to our team
Share the Post: