Appium Tutorials

Appium Tutorial Step by Step Appium Automation

Appium Tutorial 2021 is ready for all testers! I will use Appium Desktop and Android Studio to create a sample mobile test automation project for you. After that, we will continue with the Advance Appium Tutorial series. First,  we need to do a proper Appium Installation. Alright, Let’s start!

Appium Tutorial Prerequisites: JAVA and Maven Installation

Download JAVA JDK first. Here is the Link: JAVA JDK 11

Installation steps and configuration settings have described in this article at step-4 and step-5.

For MACOS users please visit the below article for all installation needs.

How to Install Appium on Mac OS with Required Tools

Windows users will go on with the below installation steps. 😉

Android Studio Installation

Let’s go to Android Studio Download and install Android Studio. After that, apply the following steps. Click the “Next” icons and finally click the “Finish“.


Click to download Android Studio based on your operating system Windows, macOS, Chrome OS, or Linux. We are going on with Windows.

After download the Android Studio, installation is straightforward. Click the next button.

appium download

Select all options and click the next button.

appium server

Select your directory or keep the default and click next. I kept it as default. 😉

appium desktop

and click the install button to start the installation process.


If it is your first time installing Android Studio then just select the “Do not import settings” option and click the OK button. If you are updating it, you can import your previous settings.

appium interview questions

Click the next button and continue.

appium capabilities

I installed the Android Studio with standard settings and configurations as shown below screenshot.

appium api

Select your UI Theme. I prefer Darcula because it is better for the eyes but you can go with the white classical theme if you want.

appium tutorial ios

Click the “Finish” button and install the required tools.

appium tutorial java

Then, just wait until all libraries to be downloaded and the installation to be finished.

appium tutorial android

After all these steps, click the finish button.

appium tutorial

After clicking the “Finish” button. Go to “Configure” > “SDK Manager” to get SDK information. It is required for Android SDK path settings.

Select your device’s or emulator’s Android API level (Version). We will go with Android 11 API, please install that one.

When took the below screenshot the latest version was 9.0 but for this example, we will go with Android 11. I am not using windows anymore thus I could not update the screenshot but I wanted to mention it to guide you correctly.

And select the required tools as shown below and click “OK.

appium inspector

Click OK one more time, please. 😉

ios testing

Click the Finish button and continue.

ios automation

After the installation of the required tools, go to the SDK Manager page and copy the SDK path as shown below. We will use it. 😉

android automation

Download RapidEE tool and install it and open it as administrator.

android testing

And then add ANDROID_HOME variable and its path should be Android SDK’s path. Also, check your JAVA_HOME variable. JAVA_HOME should equal to JAVA SDK’s path.


Then, you need to add required Android tools and JAVA JRE paths to your system path as shown below.


After that, check your settings and installations. Open a command prompt window and type “sdkmanager –list” command as shown below.

mobile automation

and type “uiautomatorviewer” to check uiautomatorviewer is working properly.

mobile testing tools

Then, create a sample project in Android Studio and then click the link as shown below to install missing libraries.

what is appium

After installation, click the Finish button.

download appium

After installing missing libraries you will see the device and little and sweet android icon. 🙂 When you click this icon, you will open the android virtual device manager.

install appium

Let’s create a virtual device. I will also explain how to do mobile automation with a real device too. Don’t worry. 😉 Click to “+ Create a Virtual Device” button.


Then, select a virtual device in the device list.

To run ARM-based apk files on X86 platforms (windows or mac),

please refer to this article:

After coming back to the above article and after installing your device, you will see the below result.

Until now, we installed JAVA and Android-related libraries and did their settings and configurations. Now, it is time to download Appium.

Appium Desktop Installation and Configurations

Go to and click the “Appium-Desktop for OSX, Windows, and Linux” link.

download appium

On the below page, click “appium-desktop-Setup-1.20.2.exe” file. (I am writing this article the latest release is 1.20.2, you can install the latest version when you are installing appium.)


When the installation file downloaded, click run and start to install appium desktop.

install appium

When installation finished, double-click the appium icon and open the appium server as shown below.


Let’s click the “Advanced” tab and change the Server Address to “” and click Allow Session Override for override session when there will be problems and click “Start Server”. If you will use a real device and then use “” for “Server Adress”.


Set Android and JAVA home in Appium Desktop.


Give the required permission to Appium Server.

You will see the server up and running.


Android Virtual Device and Pre-Test Settings

Before starting the tests you can directly install your apk or xapk files if you have. In our example, first, we will install apk pure app.

After please open the apk pure app and search for any app you want to install. In this example, I will go with the “Isin Olsun” application. My previous company’s app. 🙂

After clicking the install button, the app will be installed.

After these steps, when you click the app icon, you will see that it is opening as expected. 🙂

In order to find the splash activity, I installed the APK Info app via APK Pure application. For this, just open the APK pure app, search the “Apk Info” and install the app.

Then, I opened the APK Info app and find our application “İşin Olsun” and click it.

Then I saw all the information about our app. When I looked at the Activities section, I saw that our application is starting with ““. I will use this info in the automation code’s desired capabilities section. Also, I will use app package info which is ““


Then, open a command prompt and write “adb devices” command to see connected devices and get the device ID as shown below.

mobile devices in automation

Go to your AVD’s setting tab and check your AVD’s Android Version as shown below. We will use these settings in our test project.


Then, open IntelliJ IDE and create a new project as shown below. First, select Maven and click Next button.

appium project

Then, write your project’s GroupId and ArtifactId. You can write the same as shown below. It does not affect anything, just naming.

project appium

Then, give a name to your project.

test automation

Then, click “Enable Auto-Import” in the right bottom corner.

mobile testing

Go to website and get all frameworks’ latest dependency information. We will use TestNG, Appium, Selenium.

Our POM.xml will look like as below. You can see appium’s, selenium’s, and TestNG’s dependencies. I used JAVA11 JDK in this example.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""
        <!-- -->
        <!-- -->
        <!-- -->

Create a new Java Class as shown below and give a name to your test class. For now, keep it empty, after emulator settings, we will come back to test code at the end of the article.

android testing

Now, let’s start the emulator get your device’s information from the android studio as shown below.


After starting the application on the emulator, go to the server and click the magnifier icon to open the inspector.


Then, start to enter the capabilities of your device as shown below in the inspector.


  "deviceName": "Pixel XL API 30",
  "platformName": "Android",
  "automationName": "UiAutomator2",
  "platformVersion": "11",
  "skipUnlock": "false"

Also, you can save these settings and use them later.


and click “Start Session” to start the inspector session to get your mobile elements ids. Get mobile element’s id’s as shown below. We will use them for our first mobile automation project.


After all of these steps, we need to write our test automation code.

How to Use Real Device instead of Emulator

In emulators, you may face some problems. When I tried to run my test on the emulator XPath locators did not work. Normally, I did not want to use XPath but in our app some for some elements I did not have other options. Then, I tried the same test on a real device, my test worked flawlessly and very fast. Thus, I suggest you use real devices instead of emulators. In order to use the real device we should do the followings:


Mobile Test Automation Project by Using Appium and TestNG

It is time to write some code for our Appium Tutorial. The test code of the project is shown below. I added inline comments. The most critical part is DesiredCapabilities, the rest of the code is very similar to Selenium and TestNG test automation codes. Also, you can find this project on GitHub.

Project’s GitHub URL:

Below code opens İsinOlsun app, skips splash screen, clicks “job search” button, then accepts notifications and then clicks the second job on the main screen and that’s all. 🙂 It is easy because it is our first test case.

import io.appium.java_client.MobileElement;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class ioSampleTest {
    public AndroidDriver<MobileElement> driver;
    public WebDriverWait                wait;
    //Elements By
    By jobsBy           ="");
    By allowWhenUsingBy ="");
    By searchingJobBy   ="");
    By animationBy      ="");
    By toolBarTitleBy   ="");
    public void setup() throws MalformedURLException {
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability("deviceName", "Pixel XL API 30");
        caps.setCapability("udid", "emulator-5554"); //DeviceId from "adb devices" command
        caps.setCapability("platformName", "Android");
        caps.setCapability("platformVersion", "11.0");
        caps.setCapability("skipUnlock", "true");
        caps.setCapability("appPackage", "");
        caps.setCapability("appActivity", "");
        caps.setCapability("noReset", "false");
        driver = new AndroidDriver<MobileElement>(new URL(""), caps);
        wait = new WebDriverWait(driver, 10);
    public void basicTest() throws InterruptedException {
        //Click and pass Splash
        //Click I am searching a job
        //Notification Allow
        if (wait.until(ExpectedConditions.visibilityOfElementLocated(allowWhenUsingBy)).isDisplayed()) {
        //Click Second Job
        //Do a simple assertion
        String toolBarTitleStr = wait.until(ExpectedConditions.visibilityOfElementLocated(toolBarTitleBy)).getText();
    public void teardown() {

Then, run the test.

And the test should pass as shown below screenshot.

That’s all for this Appium Tutorial. I hope you successfully installed and configured all settings and run your mobile automation code.

If you have any questions please write a comment, me or another expert will try to help you.

GitHub Project

Other Appium Tutorials

Now, you can learn Appium Parallel Testing and How to set up your Own Wireless Mobile Device Farm!

Appium Parallel Testing on Real Devices

Appium Parallel Testing on Multiple Emulators

Appium Cucumber TestNG with Parallel Test Execution

Do you want to learn Appium Actions such as Tab, MultiTouch, Press, Swipe?

Appium Mobile Actions

I hope you like this article if you like it or if you have any troubles please share your comments with us.


Onur Baskirt