QA Interview Hub · Knowledge base · Quizzes · Українська

Appium

Appium architecture

How Appium is built: client, server, drivers

Appium is a client-server system built on the W3C WebDriver protocol. Through a client library the test sends HTTP requests to an Appium server, which passes the commands to a platform driver: UiAutomator2 for Android or XCUITest for iOS. The app does not need to be changed. Since Appium 2 drivers are installed separately, non-standard capabilities carry the appium: prefix, and a session ends with driver.quit().

Appium · Architecture

The test is written, yet Appium says "driver not found". What exactly had to be installed, and where does it live?

Appium is often seen as "a program that taps on a phone". That picture breaks as soon as an error appears: the session does not start, a driver is not found, a capability is rejected. This lesson splits Appium into parts so that each error can be traced to its place.

How it works and why. Appium is an open-source framework for automating native, hybrid and mobile web apps. Its API is the W3C WebDriver protocol with extra extensions (mobile: commands), so the approach is close to Selenium. The app does not need to be changed: for Appium it is a black box (.apk, .app, .ipa). The system has three parts.

The call chain

Test + java-clientclicks, finds elementsAppium server (Node.js)HTTP, W3C WebDriver, port 4723Driver: UiAutomator2 / XCUITesttranslates commands for the platformDevice or emulatorhelper server / WebDriverAgent
Figure 1. The test only sends HTTP requests: all the work with the device is done by the driver, and it decides what the platform can do.
  • The client is a library in your language that wraps commands into HTTP requests. For Java this is java-client, an extension of Selenium. The client version must fit the server version: branch 11 requires Appium server 3 or newer.
  • The server is an HTTP server on Node.js, by default on port 4723. The client and server need not be on one machine: this is how cloud farms work.
  • The platform driver implements the WebDriver commands: UiAutomator2 for Android (a helper server runs on the device), XCUITest for iOS (through WebDriverAgent, on macOS with Xcode).

Appium 2 and newer: drivers apart. The server no longer contains drivers. They and plugins are installed with commands and updated separately. This changed the typical first error: "I installed Appium but the session does not start", because there is no driver.

Appium 1 and Appium 2+

Appium 1

Everything in one

Drivers shipped inside the server package: updating one meant updating everything, and old protocols stayed in the code.

Appium 2+

Server and drivers apart

The server is small, drivers and plugins are installed by commands and updated at their own pace.

Figure 2. This is not "bad and good" but two models: modularity costs one extra installation step.
npm install -g appium
appium driver install uiautomator2          # Android
appium driver install xcuitest              # iOS, macOS only
appium driver list --installed              # what is installed
appium plugin install images                # a plugin, enabled by a flag
appium --use-plugins=images                 # start the server on port 4723

Other differences from Appium 1 that get asked about: the default base path changed from /wd/hub to /, so you do not write it in the server URL (the old path is restored with the --base-path flag); the old JSONWP/MJSONWP protocols were removed together with TouchAction; all non-standard capabilities carry the appium: prefix. Appium 3 raises the environment requirements (Node.js 20.19 and newer, npm 10) and removes deprecated endpoints. Appium 4 (November 2026) requires Node.js 22.22.2+ or 24.15+, drops the Windows driver and more deprecated endpoints, and makes standard capability names case-sensitive (platformName, not PlatformName). UiAutomator2 10.x and XCUITest 13.x work only with Appium 4. Driver versions are tied to the server major version, so read the driver README before upgrading.

Example: from capabilities to a session. A session starts with a creation request carrying a set of capabilities. The only standard W3C field here is platformName, everything else must carry the appium: prefix:

{
  "capabilities": {
    "alwaysMatch": {
      "platformName": "Android",
      "appium:automationName": "UiAutomator2",
      "appium:deviceName": "Pixel_7",
      "appium:app": "/builds/app-debug.apk"
    }
  }
}
CapabilityWhat it sets
platformNameA standard W3C field: Android or iOS
appium:automationNameWhich driver runs the session: UiAutomator2, XCUITest
appium:appA path or URL to .apk, .app, .ipa
appium:udid / appium:deviceNameWhich device or emulator
appium:newCommandTimeoutHow long to wait for the next command before closing the session

In Java the prefix is added by the UiAutomator2Options and XCUITestOptions classes, so it is not visible in the code:

UiAutomator2Options options = new UiAutomator2Options()
    .setDeviceName("Pixel_7")
    .setApp("/builds/app-debug.apk")
    .setNewCommandTimeout(Duration.ofSeconds(120));   // default 60 s

AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723"), options);
try {
    // the test
} finally {
    driver.quit();   // ends the session and frees the device
}

Every new driver is a new session, and it is ended by driver.quit(). If the test sends no commands for longer than appium:newCommandTimeout (60 s by default), the server closes the session itself, and the next command returns a "session not found" error. Without quit() the device stays busy, and in a cloud it is also billed.

Limits and alternatives.

  • Appium translates commands and adds an HTTP layer, so it is slower than native frameworks: Espresso (Android) and XCUITest run in the test process. They are chosen when the development team writes the tests with access to the code and speed matters. Appium wins with cross-platform reach and the language of your choice.
  • Appium sees the app through the system accessibility layer: what is not exposed in the element tree (for example a drawing on a canvas) has to be found by coordinates or by image.
  • A black box means access to internal app state is limited: test data is prepared through an API or a deep link, not by touching variables inside.
  • Plugins (for example for images) change the behaviour of the server, so they are enabled explicitly and only those needed.

Typical mistakes.

  • Installing the server but not a driver: the session does not start.
  • A capability without the appium: prefix: the server rejects the request with "All non-standard capabilities should have a vendor prefix".
  • Writing the old /wd/hub in the URL of a new server.
  • Not calling quit() in finally or @AfterEach: sessions pile up.
  • Updating the client without updating the server and driver: incompatible versions give odd errors.

Check yourself

Why does an Android session not start after installing Appium 2 with no extra steps?

Answer

The server no longer contains drivers. You must install a driver separately with appium driver install uiautomator2 and name it in the appium:automationName capability.

What is the appium: prefix in capabilities for?

Answer

W3C allows only standard fields without a prefix, and any extension must belong to a vendor namespace. In Appium it is appium:, hence appium:app, appium:udid and so on.

What happens if a test sends no commands for a long time?

Answer

After appium:newCommandTimeout (60 seconds by default) the server closes the session, and the next command returns an error. So long pauses in tests are dangerous, and quit() must always be called.

In the interview. Junior: Appium is a client-server system. The test sends HTTP requests through a client library, using the W3C WebDriver protocol, to the Appium server, which hands them to a driver: UiAutomator2 for Android, XCUITest for iOS. The app does not need to be changed. A session is described by capabilities with the appium: prefix and ended with driver.quit(). Middle/Senior: Since Appium 2 drivers and plugins are installed separately, which decouples server and platform versions. I watch the compatibility of client, server and driver, do not rely on old things (/wd/hub, TouchAction), and understand that Appium is slower than Espresso or XCUITest but gives one approach for two platforms.