Appium — Robot Framework Installation and Automation Testing Guide for IOS and Android App

Gilshaan Jabbar
3 min readFeb 13, 2025

--

Introduction

This guide will walk you through setting up Appium with the Robot Framework for automation testing on iOS and Android applications. It includes installation steps, configuration settings, and a sample test script to verify your setup.

Prerequisites

To use the Robot Framework with Appium, ensure you have the following installed:

  • Python (Required for Robot Framework)
  • Node.js and NPM (Required for Appium installation)
  • Java Development Kit (JDK) (For Android automation)
  • Android SDK (For Android testing)

1. Install Python and Robot Framework

The Robot Framework is an open-source test automation framework that requires Python.

brew install python
brew install pipx
pipx install robotframework
pipx inject robotframework robotframework-appiumlibrary
  • pipx install robotframework - Installs the Robot Framework.
  • pipx inject robotframework robotframework-appiumlibrary - Injects the Appium library into Robot Framework.

2. Install Appium

Appium is a mobile automation framework that allows you to test applications on real devices and emulators.

Before installing Appium, set up the following environment variables:

  • ANDROID_HOME: Points to your Android SDK directory.
  • JAVA_HOME: Points to your Java installation.

Then, install Appium using:

npm install -g appium

3. Install Appium Drivers

Appium requires platform-specific drivers. For Android, install the uiautomator2 driver:

appium driver install uiautomator2
appium setup

To validate the installation, run:

appium driver doctor uiautomator2

This command checks if all necessary dependencies are correctly installed.

4. Install Appium Inspector

Download and install Appium Inspector to inspect UI elements of your application: Appium Inspector GitHub Releases

5. Run Appium Server

Start the Appium server with debugging enabled:

appium --log-level debug

This command launches the Appium server and logs detailed debug information for troubleshooting.

Writing a Test Script in Robot Framework

Create a test file named test_app.robot to verify if the application launches and contains a "Login" element.

Before running the script, ensure your test device is connected by running:

adb devices

If your device is detected, it will list the device ID, which should be assigned to ${DEVICE_NAME} in the script.

Sample Test Script (test_app.robot)

*** Settings ***
Library AppiumLibrary
*** Variables ***
${REMOTE_URL} http://localhost:4723
${PLATFORM_NAME} Android
${AUTOMATION_NAME} UiAutomator2
${DEVICE_NAME} 29091JEGR05668
${APP_PACKAGE} com.myapp.sample
${APP_ACTIVITY} com.myapp.sample.MainActivity
*** Test Cases ***
Open App and Verify
Open Application ${REMOTE_URL}
... platformName=${PLATFORM_NAME}
... automationName=${AUTOMATION_NAME}
... deviceName=${DEVICE_NAME}
... appPackage=${APP_PACKAGE}
... appActivity=${APP_ACTIVITY}
... noReset=${TRUE}
... fullReset=${FALSE}
Wait Until Page Contains Update
Close App
Close Application

Run the test scrip using the below command

robot test_app.robot

Explanation of the Script

  • Open Application: Connects to Appium and launches the application.
  • Wait Until Page Contains “Login”: Verifies if the “Login” text is displayed on the screen.
  • Close Application: Closes the application after verification.

Setting Desired Capabilities in Appium Inspector

To inspect UI elements, configure Appium Inspector with the following settings:

Steps:

  1. Open Appium Inspector
  • Download and launch Appium Inspector.

2. Set Connection Details

  • Remote Host: localhost
  • Remote Port: 4723
  • Path: / (For Appium 2.x)

3. Enter Desired Capabilities

  • Click on “JSON Representation” (bottom left).
  • Paste the following JSON:
{
"platformName": "Android",
"automationName": "UiAutomator2",
"deviceName": "29091JEGR05668",
"appPackage": "com.myapp.sample",
"appActivity": "com.myapp.sample.MainActivity",
"noReset": true,
"fullReset": false
}

Once set up, you can inspect your application elements and automate testing efficiently using the Robot Framework with Appium.

Output Screens

Output of command —> robot test_app.robot
Sample output of appium inspector

References

https://appium.io/docs/en/2.15/quickstart/install/

https://appium.io/docs/en/2.1/quickstart/uiauto2-driver/

--

--

No responses yet