Connect with us

Get more updates and further details about your project right in your mailbox.

Thank you!
Oops! Something went wrong while submitting the form.
August 16, 2023

Mobile Automation Testing using Appium and Python

The best time to establish protocols with your clients is when you onboard them.


Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.


Appium is an open-source tool you can utilize to automate mobile web, mobile native, and mobile hybrid applications on iOS and Android outlets. Appium is “cross-platform” in that it enables you to create tests using the same API for a variety of platforms, including iOS, Android, and others. This enables significant or complete code reuse between iOS and Android test suites.

We will cover the Windows-Android setup in this article.

Requirements for the setup:

  1. Appium and Appium inspector
  2. Latest edition of Python and JAVA
  3. Android Studio
  4. Emulators
  5. Plugins installation
  6. IDE (VS Code or PyCharm)
  7. Sample test run

Appium Setup:

Download the latest Appium and Appium Inspector

Appium server can be installed using two ways.

NPM install Appium

  1. Download Node
  2. Install the Node and follow the setup wizard
  3. After Node is installed, open cmd and run npm install -g appium
  4. Enter the Keyword appium to run the Appium server

Download Appium Desktop

  1. Download the Appium desktop
    (This is link for 1.21.0 version, with this version we don’t need to install the appium inspector separately. Inspector was in-built until this version)
  2. Run Appium and start the server

If you using 1.21.0 or before, the below Appium Inspector installation does not apply. You can directly open the inspector from the Appium server page by clicking the search button.

Download Appium Inspector

  1. Download the Appium inspector
  2. Appium inspector is used to locate the elements and find the paths of the elements in a page
  3. Open the Appium inspector

Download Python and Java

Python Installation

  1. Download the latest version of Python
  2. Launch the installer and install. Check the ‘Add Python to PATH’ checkbox to add the path to the environment path
  3. Open cmd and run the command ‘python’ to check the python is installed properly.

Java Installation

  1. Download the latest version of JAVA Jdk
  2. Add a new path JAVA_HOME in environment variables like below
    (Added the JAVA_HOME for the appium setup)

Android Studio Installation

  1. Download the Android studio
  2. Open the Android studio and launch the AVD manager.
  3. Build an emulator on your choice and launch it.
  4. Add the ANDROID_HOME path in environment variables.
    (ANDROID_HOME path for the appium setup, here app data is hidden in the folder so you need to change the view settings of the folder to show the hidden files also)

5. Add the base paths of the build tools, tools, and platform tools to the environment variable like below.

Emulator Installation

  1. Download and install the BlueStacks emulator follow the steps provided by the installation process.
    (Why we are using the Bluestacks? BlueStacks is lite compared to Android Studio. You can also use any other emulators as you wish or even your actual mobile devices for automation)
  2. Open the Settings and in advanced settings turn on the ADB debugging.
  3. Open cmd and enter the command ‘adb devices’ to know the device is compatible for adb debugging.

Plugins installation

Install plugins like Selenium and Appium Python Client

Open cmd and run the below commands

pip install selenium

Install Selenium using this command.

pip install Appium-Python-Client==2.0.0

Install Appium Python Client using this command.

IDE Installation(VSCode or PyCharm)

  1. Download and install the latest version of the VSCode.
  2. Open the VSCode and start writing your script.

Virtual environment setup

Now, all the setups are done, It’s time to begin developing the mobile application’s automation script.

I am using a virtual environment for my project.

Command to create a venv ‘python -m venv /path/to/folder’

I created a folder tests in my venv to write the automation scripts.

Appium Inspector walk-through

Before we start writing the test script we need to locate the elements of the application to write the test scripts.

Run the Appium and Appium Inspector to create the local session.

Add the Desired Capabilities as per your requirements (device name and application path) and start the session. It will start the application and shows the application page in the inspector, where you can get the locators such as id, Xpath, text, class, etc. Here I have used the Flipkart application to test.

In the above screenshot we can see the first page of the Flipkart application. In that we can get the locators of the elements which we need to locate. Using these locators we start writing the sample test case to run.

Sample test run

Here we add some desired capabilities in a file ‘’. This is the capability file to run the automation.

Create a test file to start the basic automation.

Here I have imported the needed packages and capability file(des_cap) and then initialized the driver. In the automation script, I tried to choose the language using the name of the element, then clicked the ‘continue’ button using the ID, then input the mobile number using the id and send_keys method and then used Xpath to click the ‘next’ button. Here I have used the most important locators to write the script.

This is a sample test run to show how the automation works. You can check the Appium documentation to know more information. Please comment below if you have any queries.

August 7, 2023
min read
Subscribe to our newsletter
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Share this article:

More articles