Table of Contents

Kickstarting Mobile Automation with Appium

Master Appium automation for Android and iOS by building cross-platform mobile tests from setup to execution, and easily scale your app testing.

Author

Saurabh Kumar Singh
Saurabh Kumar SinghSoftware Developer Engineer in Test- II

Date

Oct 28, 2025

From Setup to Your First Test on Emulator and Real Device


Mobile apps dominate the digital experience; delivering bug-free applications quickly is non-negotiable. Whether it’s a shopping app or a fintech solution, quality assurance must scale with development.

This is where Appium shines — enabling robust, cross-platform mobile automation.

In this blog, you will walk through:

  • What Appium is and how it works
  • Setting up your automation environment
  • Running your first test on the emulator and real devices
  • Common issues and how to fix them
Let’s begin your mobile automation journey!

What is Appium?

Appium is an open-source automation tool that allows you to test native, hybrid, and mobile web apps on both Android and iOS platforms — using the same API. Built on the WebDriver protocol (just like Selenium), Appium provides the flexibility to write tests in your favorite programming language.

Why Appium?

  • No need to recompile or modify the app under test
  • Supports Java, Python, JavaScript, Ruby, and more
  • Works across Android and iOS platforms
  • Completely free and actively maintained
Appium saves time and effort by making your mobile test code portable and scalable across platforms and devices.

Understanding Appium Architecture

Appium operates on a client-server model built over the WebDriver protocol. It acts as a bridge between your automation scripts and the mobile device — whether it’s an emulator, simulator, or a real phone. This architecture allows platform-independent test execution using a single API.

Here’s a simplified view of its core components and how they interact:

1. Appium Client

This is your test script, written in languages like Java, Python, JavaScript, etc., using WebDriver-compatible libraries. It sends automation commands (like click, type, scroll) to the Appium Server via HTTP.

2. Appium Server

A lightweight Node. JS-based server that listens for incoming requests from the client. It interprets those commands and routes them to the appropriate mobile automation engine based on the platform (Android/iOS).

3. Automation Engines

These engines handle the actual interaction with the device’s UI:

  • UIAutomator2 / Espresso (Android) – Executes commands on Android devices
  • XCUITest (iOS) – Executes commands on an iOS device

4. Mobile Device (Emulator, Simulator, or Real Device)

The target device where your app is installed and tested. This is where the actual interactions (clicks, swipes, input, etc.) happen, driven by the automation engine.

5. Platform-Specific Bootstrap Components

Appium deploys helper apps (like uiautomator2-server.apk and Appium Settings for Android) to facilitate communication between the Appium Server and the OS. These components ensure commands are reliably executed on the device.

How Appium Executes a Test Command

Here’s the complete flow of a single test command inside Appium’s architecture:

  1. Command Sent: Your test script (client) sends a command using WebDriver over HTTP (e.g., “Tap the Login button”).
  2. Server Processes: The Appium Server receives and parses the command, checks the desired capabilities to identify the platform.
  3. Routing to Engine: Based on the platform (Android/iOS), the server forwards the command to the correct automation engine.
  4. Interaction with Device: The engine acts as the app via the connected device or emulator.
  5. Response Returned: The result (success/failure) travels back through the engine and server to the test script.
This separation ensures flexibility and supports a wide range of platforms and use cases.

Prerequisites Before You Begin

To get started with Appium, ensure the following software and tools are ready:

Required Tools:

  • Java JDK (11 or higher)
  • Node.js & npm
  • Android Studio (for SDKs, emulator, platform tools)
  • Appium CLI
  • Appium Inspector
  • Code Editor or IDE (e.g., IntelliJ, VS Code)

Programming Language Setup

Depending on your choice (Java, Python, Node.js), install the respective language and dependencies. For this blog, we’ll use Java for examples.

Setting Up Your Automation Environment

Here’s a step-by-step installation guide:

1. Install Node.js & NPM

Download from https://nodejs.org or use Homebrew on macOS:
Bash:

2. Install Appium CLI Globally

bash:

To start the server:

Bash:

3.  Verify Setup with Appium Doctor

bash:

It will check for missing dependencies, such as Java and Android tools.

4. Install Appium Inspector

Download from GitHub Releases. This tool allows you to inspect UI elements on your app and generate locator strategies. Ensure you download the corresponding file for your operating system.

Otherwise, you can use a web version of Appium Inspector, which will work similarly.

Appium Inspector Web

5. Set Environment Variables


Ensure you add these to your .zshrc or .bash_profile:

Bash:

Then:


Bash:

Android Studio & Emulator Setup

1. Install Android Studio


2. Set Up SDK Tools


  • Open Android Studio → SDK Manager
  • Install: SDK Tools, Platform Tools, and Build Tools

3. Create and Launch an Emulator


Use AVD Manager inside Android Studio to create a virtual device. Ensure it's a recent Android version (e.g., API 30+).

Follow the process to launch an emulator:

1. Launch the application and click on Virtual Device Manager.

Virtual Device Manager - Android Studio

2. Under Device Manager, click on the plus icon to create a new virtual machine.

Creating a new Android virtual device using the plus icon in Android Studio Device Manager.

3. Select the device configuration from the list of virtual devices and click on “Next”.

Android Studio with Pixel 7a device configuration

4. Complete the configuration process by selecting the operating Android version.

Android Studio AVD setup displaying available Android system images for download

5. Update the name of the virtual device and click on “Finish”.

Android Studio Verify Configuration dialog with editable AVD name field

6. And you are almost done:

Device Manager with virtual devices listed and emulator launch progress dialog
Active Android virtual device with app icons visible next to Device Manager list

Getting Started with ADB (Android Debug Bridge)

ADB is a powerful command-line tool that lets you communicate with Android devices.


Common ADB Commands:

Bash:

Make sure your device or emulator is listed:


Bash:

NOTE: If you're using a virtual device (emulator), ensure it is in a running state.
If you're using a real Android device, make sure it is properly connected to your system via USB and that Developer Options with USB Debugging are enabled.

Command to find App Package and App Activity:

Make sure the app is in a running state in the emulator/physical device.

Writing Your First Appium Test on Emulator

1. Define Desired Capabilities (JAVA):


JAVA:

Desired Capabilities for Appium Inspector to Inspect Mobile Elements:

Appium Inspector interface with capability settings and JSON representation panel

2. Sample Test Code: Launching Emulator Chrome Browser


JAVA CODE:

Run the script using Maven(Archetype - Quickstart)  or your IDE(IntelliJ IDEA).


3. POM.XML File

Running the Same Test on a Real Device

1. Prepare Your Device:


  • Enable Developer Options and USB Debugging
  • Connect via USB and authorize debugging.
  • The above code needs Appium version 2.19.0

2. Update Desired Capabilities:

JAVA:

Your test should now run on the physical device.

Troubleshooting Common Issues

IssueFix
Emulator not detected Restart the emulator, check the adb devices
Appium server error Restart the server, validate capabilities, and check the Java Client compatibility.
APK not installing Check the path, permissions, or compatibility
Environment variable errors Verify ANDROID_HOME, JAVA_HOME, and add to PATH

Conclusion & What’s Next

Congratulations! You have just automated your first mobile test with Appium on both an emulator and a real device. In this journey, you’ve set up the environment, learned about ADB, and interacted with elements programmatically.

SHARE ON

Related Articles

Dive deep into our research and insights. In our articles and blogs, we explore topics on design, how it relates to development, and impact of various trends to businesses.