How to Install Appium in Windows OS and write first test script.

Published On: 11 February 2021.By .
  • Quality Engineering


  • Appium is an open source, cross-platform mobile application testing tool.
  • Support Json
  • Support automation test on physical device as well as Similar or emulator both.
  • It no dependency on mobile device.

Appium installation on windows OS:-

Before appium installations download the following

  1. JAVA IDE (Eclipse)
  2. JAVA JDK (1.8 or higher version) installation from here
  3. Android Studio (To Connect device)
  4. Selenium Server jars
  5. Appium jars
  6. npm & node.exe
  7. TestNG for Eclipse
  8. ADT plugin (it used to access android SDK within eclipse)
  9. Set SDK path in windows

Supported Devices:-

  1. Android 4.4 and Above.
  2. IOS 9 and Above

Set JDK Path in Windows

1) Note down the path where JDK is installed in your system.

2) Copy the path till bin folder because that is where the java application is found.

3) Open Control Panel>> System >>Advanced System Settings>> Environmental Variables>> Click New.

4) click on OK, variable reflect in the list of environmental variable set.

5) Make sure that the system can accept the Java that is installed, go to the CMD and type ‘java –version’.

Should result version of the JDK installed in the system.

Install Android SDK (Software Development Kit)

1) Download Android SDK from

2) Clicks on the link “” (or which is the latest you find there) and then click on “Download” button.

3) zip file gets downloaded, unzip the folder.

Set Environment Variable for android SDK:-

1) Note down the path of Android SDK is installed.

2) Click on Environment Variables >>Create a new user variable ANDROID_HOME>> and set the Android SDK path.

3) Set 2 paths in the system variable Path:

  • Path of the “platform-tools” folder in the Android SDK bundle (For Example, C:\User Files\Appium Automation\Android\android-sdk\platform-tools).
  • Path of the “tools” folder in the Android SDK bundle (For Example, C:\User Files\Appium Automation\Android\android-sdk\tools).

Install Appium

1) Open the Appium

2) Click on the “Download” link.

3) Select the OS of the machine that you are working on and download the appropriate version.

4) Unzip the downloaded zip folder.

5) Install the .exe file “appium-installer”.

6) Specify the path for installation.

Install Node.js

Node.js comes with Appium. But in some cases, it doesn’t work. So on the safer side, install it separately.

  1. Visit this
  2. Click on the Windows Installer tab.
  3. Download Starts.
  4. Install it.

Selenium Jar Files

This is required for the interaction between test scripts and Selenium WebDriver.

1) Go to the link.

2) Click on the Download link JAR available (selenium server standalone and java client library jar files).

3) Extract the downloaded zip folder.

Add the Libraries to the Project

1) Open Eclipse IDE.

2) Create a new Java Project>>Create a new package under this project>> Create a new class under this package.

3) Right-click on your Project name>> Select Build Path>> Select Configure Build Path.

4) Click on the “Add External JARs” button>>go to the path where you have saved the Selenium WebDriver zip folder.

5) Select both the .jar files.

6) Now select all the .jar files inside the libs folder.

7) Jar files are added as a part of the project dependencies as shown below.

8) Jar files are added as a part of the project dependencies as shown below.

Appium Client Libraries

We require language-particular client drivers. As we will be working on Java, we will require the Java client drivers.

1) Go to the link.

2) Click on the Java link under the “Appium Client Libraries” section.

3) Click on the JAR link.

4) Download Start.

Configure Library file (all dependencies) with Project:

  1. Right click on Project name>>Select Build Path>>Select Configure Build Path.
  2. Click on the “Add External JARs” button>> go to the path where you have saved the Java Client jar file.
  3. Now select the jar file and add it.
  4. Jar file added like a part of the project dependencies  shown below.

Configuring Mobile Device with System in Appium

Explains how to connect  Mobile Device with PC and configure  for Automation Testing Using Appium. And Verification of Mobile by ADB :

  • USB Debugging mode is enabled on  mobile device.
  • ADB acknowledge the device connected to the system.
  • Changing the Desired capability as per the device/application

Enable USB Debugging Mode in Mobile Device

1) Developer Options

  1. Open to the “Settings” app on the phone.
  2. Scroll down and click on Developer Options.
  3. Turn on the “Developer Options” and click the “USB Debugging”.

Some devices not have “Developer Options” in Settings. In this cases, follow the following steps:

  1. Navigate to Settings > About Phone > Build Number.
  2. Tab on Build number 7 times, then a pop up will appear saying “You are now a developer”.
  3. Go back to settings. You will find “Developer Options” getting listed.
  4. Enable “USB Debugging” and now the device is ready to connect to the system
  5. After done, you will now be able to enable/disable it whenever you desire by going to Settings>> Developer Options >>Debugging >> USB debugging.

Verify If System Recognizes a Device Using ADB

To verify if the system is able to recognize the device,

  • Open command prompt
  • Type >>”adb devices”
  • Click on “Enter”.

Desired Capabilities

Desired Capabilities is a JSON object sent by the client libraries to Appium server.

Desired Capabilities is a class in Selenium and is used to store properties of applications and devices.

Properties are read by Appium at run time and recognize the device and application for automation. Need to import “import org.openqa.Selenium.remote. DesiredCapabilities” library file and add to the project in order to work with the Desired Capabilities.

In order to ensure automation on the mobile device connected.

Major capabilities used for Automation are:-

Capability  Explanation
platformName In this we can pass value “Android”, “IOS”, FirefoxOS:
platformVersion Set the mobile OS Version like caps.setCapability(“platformVersion”,”5.6″);
deviceName Enter device name or emulator to use caps.setCapability(“deviceName”, “Redmi9’”);
appPackage Java package of android app to run example for setting app
appActivity Enter particular app activity MainActivity
browserName Enter Name of Browser if you want run mobile web automation caps.setCapability(“browserName”, ” Chrome”);

Steps To Automate a Native App

1) Connect the Mobile Device Or Create an Emulator

Connect mobile device using a USB cable or create virtual device in the system.

2) Get Details of App to be launched

Install the app in the device emulator.

There are 2 ways to install the application

  • From play store: Install directly from the PlayStore.
  • Use apk file: An ‘apk’ file from which it is installed. Can directly install the application in the device using the apk file.

3) Start Appium Server

Open CMD and Enter # appium

4) Appium Test Script

configuration to start Appium.

Desired Capabilities, Properties of Device, Application, and Browser are defined.

5) Interact With Elements Using UIAutomator Viewer

 Inspect elements, we have a tool called UIAutomatorViewer in the Android SDK package.  Tool provided by Android SDK that lets you inspect elements in your mobile app.

UIAutomatorViewer comes with an Android SDK bundle. There are 2 ways in which you can open UIAutomatorViewer.

Open UIAutomator Viewer From Andoird SDK Bundle:

To open redirect to the location where Android SDK is installed. In my case the path of UIAutomatorViewer “C:\Users\user\AppData\Local\Android\Sdk\tools\bin”

Once the batch file is run, the tool gets opened.

Open UIAutomator Viewer From Command Prompt:

  • Go to the command prompt.
  • Type >>uiautomatorviewer and hit Enter.

How to inspect Mobile Elements using UI Automator Viewer:

  • The mobile is connected to the system.
  • Open the app on mobile device.
  • Inspect elements on the active mobile screen, click on Icon in the UIAutomatorViewer tool on the top left, to capture screenshot of the active screen on the device.
  • Icon on the left takes a screenshot of the screen currently open on the mobile device and its properties are which each element can be identified.

You will find the screenshot of the mobile device in the left pane, and the right pane will hold the node structure and properties of each Node.

When you hover on element in screenshot, its attributes listed in the right panel with its value.

Element can be identified using Id, ClassName, Xpath, etc.

6) Run the Script and automate the app

  • Run script as a Java application or from TestNG.
  • After execute, the Appium files logs for all actions performed against the mobile device.

The log holds details as:

  1. Appium session was established.
  2. Device details, Application details are recognized and the connection is made.
  3. Actions in the script are executed and result to client for success message.


Related content

Got an Idea?

Let’s create a better tomorrow together