Kickstarting Mobile Automation with Appium

Oct 24, 2025

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 SinghQA Automation Engineer I

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:

Brew install node

2. Install Appium CLI Globally

bash:

npm install -g appium

To start the server:

Bash:

Appium

3.  Verify Setup with Appium Doctor

bash:

npm install -g appium-doctor
appium-doctor

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

Appium Inspector Web

5. Set Environment Variables


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


Bash:

export JAVA_HOME=$(/usr/libexec/java_home)
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH

Then:


Bash:

source ~/.zshrc   # or source ~/.bash_profile

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:

adb devices                # List connected devices
adb install app.apk        # Install an app
adb uninstall <package>    # Uninstall an app
adb logcat                 # View device logs

Make sure your device or emulator is listed:


Bash:

adb devices

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:

adb shell dumpsys window | grep -E 'mCurrentFocus|mFocusedApp'

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:

caps.setCapability("deviceName", "My Phone");
caps.setCapability("udid", "your_device_udid"); // Replace with your actual device ID
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "15.0"); // Adjust as per your device
caps.setCapability("appPackage", "com.android.vending");
caps.setCapability("appActivity"," com.google.android.finsky.activities.MainActivity");
caps.setCapability("noReset", true); // Use boolean instead of string

Desired Capabilities for Appium Inspector to Inspect Mobile Elements:

{
  "appium:automationName": "UiAutomator2",
  "appium:platformName": "Android",
  "appium:platformVersion": "15",
  "appium:deviceName": "emulator-5554",
  "appium: app": "/Users/saurabhkumarsingh/Downloads/Android.SauceLabs.Mobile.Sample.app.2.7.1.apk",
  "appium:appPackage": "com.swaglabsmobileapp",
  "appium:appActivity": "com.. swaglabsmobileapp.SplashActivity"
}
Appium Inspector interface with capability settings and JSON representation panel

2. Sample Test Code: Launching Emulator Chrome Browser


JAVA CODE:

import java.net.MalformedURLException;
import java.net.URL;

import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

public class App {

    public static void main(String[] args) throws MalformedURLException, InterruptedException {

        // Step 1: Set Desired Capabilities
        DesiredCapabilities dc = new DesiredCapabilities();
        dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");   // Automation engine
        dc.setCapability(MobileCapabilityType.DEVICE_NAME, "Android");     // Device name (any string if using emulator)
        dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");   // Platform name

        // Step 2: Provide App Details (App Package & App Activity)

        // Example: Launching Chrome Browser
        dc.setCapability("appPackage", "com.android.chrome");
        dc.setCapability("appActivity", "com.google.android.apps.chrome.Main");

        // Step 3: Define Appium Server URL
        URL url = new URL("http://127.0.0.1:4723/wd/hub");

        // Step 4: Initialize the Android Driver
        AndroidDriver<MobileElement> driver = new AndroidDriver<>(url, dc);

        // Step 5: Keep the app open for a few seconds
        Thread.sleep(5000);

        // Step 6: Quit the driver.
        driver.quit();
    }
}

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


3. POM.XML File

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>appium-project</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <!-- โœ… Appium Java Client -->
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>7.6.0</version>
        </dependency>

        <!-- โœ… Selenium (WebDriver support) -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.141.59</version>
        </dependency>

        <!-- โœ… Apache Commons Lang (extra utilities for strings, objects, etc.) -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.8.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- โœ… Maven Compiler Plugin (ensures Java 8 compatibility) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

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:

caps.setCapability("deviceName", "MyDevice");
caps.setCapability("udid", "your_device_udid"); // Optional but useful

Your test should now run on the physical device.

Troubleshooting Common Issues

Issue

Fix

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.

Subscribe to Our Newsletter

More from the engineering frontline.

Dive deep into our research and insights on design, development, and the impact of various trends to businesses.
Insight
Building Local LLMs Using Dart FFI And llama.cpp: Beyond Wrapper Packages
Sep 11, 2026

Building Local LLMs Using Dart FFI And llama.cpp: Beyond Wrapper Packages

Build local LLMs in Flutter with Dart FFI and llama.cpp, and see how native bridges, GGUF models, memory management, and token streaming enable private, on-device AI.

Insight
My Flutter App Froze With Three Photos on Screen. Here's What I Was Doing Wrong
Sep 11, 2026

My Flutter App Froze With Three Photos on Screen. Here's What I Was Doing Wrong

This blog explains how rethinking Flutterโ€™s image-processing architecture fixed severe performance issues and improved rendering efficiency.

Insight
Building a Production-Ready Canva-like Editor with Konva.js, React 19 and Next.js 15
Sep 10, 2026

Building a Production-Ready Canva-like Editor with Konva.js, React 19 and Next.js 15

This blog explains how to build a production-ready canvas editor with Konva.js, React, and Next.js, covering architecture, performance, and key engineering decisions.

Insight
What a PHP-to-NestJS Banking Migration Taught Us About Architecture, Security, and Trust
Sep 8, 2026

What a PHP-to-NestJS Banking Migration Taught Us About Architecture, Security, and Trust

This blog explores the architecture, security, performance, and documentation lessons from migrating a legacy PHP/Laravel banking platform to NestJS.

Insight
Building Production-Grade Video Thumbnail Scrubbing in the Browser: HLS, Frame Extraction, Caching, and Performance Trade-offs
Sep 7, 2026

Building Production-Grade Video Thumbnail Scrubbing in the Browser: HLS, Frame Extraction, Caching, and Performance Trade-offs

This blog explains how to build responsive video thumbnail scrubbing in the browser for local files and HLS streams, covering frame extraction, caching, and performance trade-offs.

Insight
The Agent Can See Your App. How Often Can It Look?
Sep 4, 2026

The Agent Can See Your App. How Often Can It Look?

AI coding agents can now interact with mobile apps, but their effectiveness depends on iteration speed. This blog explores how React Native architecture influences feedback loops and AI-driven developer productivity.

Insight
Building Interactive Cards from Design JSON Without Killing Your Feed: Overlays, Video, Mute/Unmute, and Lag-Free Lists
Sep 1, 2026

Building Interactive Cards from Design JSON Without Killing Your Feed: Overlays, Video, Mute/Unmute, and Lag-Free Lists

Learn how to turn design JSON into interactive, video-enabled cards using overlays, smart media controls, caching, and virtualization without slowing down high-cardinality feeds.

The Right Conversation Can

Save You Six Months.

Book a call
Kickstarting Mobile Automation with Appium - GeekyAnts