Exit course
Chapter 2 of 8 Intermediate 6 min read 2 quick checks Updated

Learn about Appium

Watch this chapter Starts at 1:13 in the 7:15 course video.
On this page
  1. Appium 3 and the driver model
  2. Installing Appium locally
  3. Capabilities: telling Appium what to start
  4. Simulators, emulators or real devices?
  5. Appium Inspector
  6. Creating the WebdriverIO project

Appium is an open-source automation server for mobile apps. It lets a test script do what a user does on a phone: tap, type, swipe, rotate, background the app, and read what is on screen. It works with native apps, hybrid apps (native shells with webviews) and mobile browsers, on both simulators/emulators and physical devices.

The key design decision behind Appium is that it speaks the same W3C WebDriver protocol as Selenium. Any WebDriver client can talk to it, which is why you can write Appium tests in WebdriverIO, Java, Python or C#, and why the concepts you learned for browser automation (sessions, capabilities, element references) carry over.

Appium 3 and the driver model#

Since Appium 2, the server ships with no platform support at all. Platform support comes from drivers that you install separately, and optional behaviour comes from plugins. Appium 3 keeps this model and removes the legacy code that was deprecated in Appium 2.

The two drivers you will use most:

Driver Platform Built on appium:automationName
UiAutomator2 Android (apps and Chrome) Google UiAutomator UiAutomator2
XCUITest iOS, iPadOS, tvOS (apps and Safari) Apple XCTest, WebDriverAgent XCUITest

Other drivers exist for Espresso, Flutter, macOS and Windows apps, and more. Because each driver registers its own name, Appium needs appium:automationName to know which one should handle your session. Appium 1 guessed it; Appium 2 and 3 do not.

Installing Appium locally#

Appium 3 needs Node.js ^20.19.0 || ^22.12.0 || >=24.0.0 and npm 10 or newer. WebdriverIO 10 has a stricter floor (Node.js 22+), so use Node 22 or 24 for this course.

npm install -g appium
appium --version

appium driver install uiautomator2   # Android
appium driver install xcuitest       # iOS, macOS only, needs Xcode

appium driver list --installed      # what is installed
appium driver doctor uiautomator2   # check driver prerequisites

appium                              # starts the server on http://127.0.0.1:4723

appium driver doctor checks the environment each driver needs: ANDROID_HOME, the Android SDK platform tools and a JDK for UiAutomator2; Xcode and its command line tools for XCUITest. Fix whatever it reports before you debug anything else.

Appium 3 also changed how risky features are enabled. Features such as running adb shell commands must be allowed with a driver-scoped name, for example appium --allow-insecure=uiautomator2:adb_shell, or *:adb_shell for every driver. The unscoped adb_shell form from Appium 2 is no longer accepted.

You start Appium 3 with appium --allow-insecure=adb_shell, but mobile: shell is still refused on Android. Why?

Appium 3 dropped the unscoped feature names that Appium 2 accepted. The flag has to say which driver the feature is allowed for.

Capabilities: telling Appium what to start#

A session starts with a set of capabilities. In the W3C format only a few keys are standard (platformName, browserName, browserVersion). Everything Appium-specific carries the appium: prefix:

const capabilities = {
  platformName: 'Android',
  'appium:automationName': 'UiAutomator2',
  'appium:deviceName': 'Pixel 8',
  'appium:platformVersion': '14',
  'appium:app': '/absolute/path/to/app.apk',
  'appium:newCommandTimeout': 120
}
  • appium:app is a local path or a URL to an .apk, .ipa or zipped .app. Alternatively use appium:appPackage/appium:appActivity (Android) or appium:bundleId (iOS) for an app already installed.
  • appium:newCommandTimeout is how many seconds Appium waits for the next command before it assumes your client is gone and ends the session.
  • Unprefixed deviceName or automationName keys are ignored by Appium 3, and WebdriverIO 10 no longer treats them as a signal that the session is a mobile one. This is the most common reason old configs "suddenly" stop working.

If you need a refresher on which keys moved where, the Appium 2 migration article covers the capability changes in detail; everything in it still applies to Appium 3.

The app under test is already installed on your Android test phone, and you do not want each session to reinstall it. What do you set instead of appium:app?

On Android, an installed app is started by package and activity. appium:bundleId is the iOS equivalent, and browserName is for mobile browsers.

Simulators, emulators or real devices?#

You can run the same test against iOS simulators, Android emulators or physical devices. Each has a place:

  • Simulators and emulators start quickly, are free to run locally, and are fine for most functional checks during development.
  • Real devices are the only way to see real performance, real GPU rendering, camera and biometrics behaviour, vendor Android skins, push notifications and battery or network conditions. Apps that pass on an emulator still fail on specific hardware.

A practical split: run the bulk of the suite on emulators and simulators on every commit, and the critical journeys on a set of real devices before release.

Appium Inspector#

To write a locator you need to know what the element looks like to the automation framework: its accessibility ID, resource ID, class and position in the hierarchy. Appium Inspector shows a live screenshot of the app next to its element tree; click an element and it shows the attributes and suggested locators.

It comes in two forms: a desktop app for macOS, Windows and Linux, and an Appium server plugin. With Appium 3:

appium plugin install inspector
appium --use-plugins=inspector      # then open http://127.0.0.1:4723/inspector

The old hosted web version at inspector.appiumpro.com is no longer run by the Appium team, so don't rely on it. On TestingBot you can also attach Appium Inspector to a cloud device instead of running one locally.

Creating the WebdriverIO project#

With Appium installed, scaffold the project you will use for the rest of the course:

mkdir calculator-tests && cd calculator-tests
npm init wdio@latest .

The wizard asks where tests should run (choose mobile/native app testing), which framework (Mocha), and whether to add the Appium service. It writes a package.json with "type": "module", a wdio.conf.js (or .ts), and an example spec. The Appium service starts and stops a local Appium server for you during the run, so you don't need a separate terminal.

In the next chapter you will learn how to find elements in a native app, which is where most of the real work in mobile automation goes.