Appium Tool for Automation Testing of Android Apps on an iOS System

Appium is an open source test automation tool used for testing mobile applications. It allows users to test various types of mobile applications (such as Native, Hybrid and Mobile Web) using standard WebDriver library.

Using Appium, you also run automated tests on actual devices like tablets, mobile phones etc. Appium makes mobile app regression testing easy; especially, for large mobile apps that  are updated frequently with new features and functionalities. 

Most testing professionals prefer Windows platform for Appium testing and there is enough help on the web on this topic. However, this Appium tutorial will help you automate android apps on an iOS system for which little documentation is available.


The article is divided into three sections:

  1. The first section explains the software required for the task
  2. The second is the setup on the device and
  3. Finally, the procedure to run the automation tasks on the device

Setup Appium with Eclipse IDE:

Software Required for Appium:

  • JDK, Appium Server, Eclipse, Android SDK
  • Jars: java-client jars and Selenium Jars.
  • Apk: Application to be automated
  • Real Device: In this case SAMSUNG Note3
  • USB driver for Real Device: In this case SAMSUNG Kies

Step 1: Install the Java Development Kit (JDK)

Step 2: Setup Java Environment Variable Path

Go to the Terminal and type:
Open .bash_profile


Set the ANDROID_HOME Path as well as JAVA_HOME Path

Step 3: Install Android SDK / ADB on MAC

We need to install Tools, Extras and corresponding API Level packages (in this  case Android 4.4.2 API 19).

(Note: Click on any image for enlarged view)


Step 4: Download and install Appium Server


Note 1:  No need to set anything in general setting icon. When Appium Server is installed, the Server address as well as Port address will be set by default. Port address will be 4723. The user can change server address if required.

Note 2: In Android Setting, the user needs to set APK path where the APK is located, Check app path, package and launch Activity.


How to Find .Apk File Package Name and Launcher Activity Name:

There are so many ways to find out Package name and Launcher Activity Name of an application. Here terminal is used to get Package and Launcher Activity name.

Go to terminal and type:

aapt dump badging <apk_File_Path><apk_File_Name.apk>

Hit “Enter” for the below screen:


If a user specifies package name in Appium Server, then Launcher Activity Name, wait for Activity names to be displayed automatically.

In this case Launcher Activity Name is:”

Steps to Enable Developer Mode / Options on Android Phone or Tablet

Step 1: Enable Developer Options

1) Tap on the Main Menu icon.

2) Go to Settings.

3) Scroll down to ‘About phone‘ and tap on it.

4) Scroll down to the bottom, tap on ‘Build number’ Seven (7) times. (Your build number may vary). After the third tap, the user can see a playful dialog “You are a developer”. Keep on tapping until the dialog is displayed.

5) You can notice the Developer Options on your screen now.


Step 2: Switch On USB Debugging

1) Go to Developer Options.

2) Select USB Debugging.


3) It may display the Pop Up message and if it does, simply click OK.

Step 3: Download and install USB Driver for Corresponding Real Device. In this case SAMSUNG Kies.

How to Locate Element using UIAutomatorViewer?

1) The first step before locating any element on the device is to connect the device to the computer.

Follow the below steps to check the device connectivity:

  • Go to Terminal.
  • Type ‘adb devices


This will display the list of devices connected to the system.

2) On the real device, open the app that has to be automated (Here amazon app is automated)

3) Go to the following directory to open UIAutomatorViewer:

Users -> Library -> android -> sdk -> tools -> uiautomatorviewer.bat

EX: users/bikram.badatya/Library/Android/sdk/tool/

4) In UIAutomatorViewer, click on Device screenshot.


5) On clicking Device screenshot, device image along with the detailed information will be displayed on the left side of the UIAutomator window.

6) On clicking any element in the page, relevant information about that element will be displayed on the right side.


7) Click on Main Menu button to display all properties.

Appium Test to Launch Amazon App

1) Launch Appium Server.


2) Android Settings.


3) General Settings for Server Address and Port address:


4) Click on the launch button.

Code snippet to launch Amazon Application:

package com.AppiumDemo;

//Library to create the path to APK
//Library used to verify if URL is malformed

//Library used to create URL for the Appium server

import java.util.concurrent.TimeUnit;

//Libraries for import selenium WebDriver
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

//Libraries for configuring Desired Capabilities
import org.openqa.selenium.remote.DesiredCapabilities;

//Library for import TestNG
import org.testng.annotations.Test;

//Libraries for import Appium Drivers
import io.appium.java_client.MobileElement;

public class LauchAmazon {
	private static AndroidDriver&lt;MobileElement&gt; driver;
	 //static WebDriver driver;
		public void setup() throws MalformedURLException, InterruptedException{
			// Path to &lt;project folder&gt;&lt;Amazon&gt;
			File appDir = new File("//Users//bikram.badatya//Library//Android//sdk//platform-tools//");
			//Path to &lt;project Folder&gt; to  Amazon apk File&gt;
			File app = new File(appDir, "Amazon.apk");
			//To create an object of Desired Capabilities
			DesiredCapabilities capabilities = new DesiredCapabilities();
			//To set Command Timeout in appium server.Its optional you can set in appium Server itself.
	        capabilities.setCapability("newCommandTimeout", 100000);
	        // Name of the OS: Android, iOS or FirefoxOS
		    capabilities.setCapability("platformName", "Android");
		    //set the name of the connected have to give same name in both server and the code
		    //Mobile OS version. My device is running Android 4.4.2
		    //set the package name of the app 
		    capabilities.setCapability("appPackage", "");
		    //set the Launcher activity name of the app
		    capabilities.setCapability ("appActivity","");
		    // Name of mobile web browser to automate. It should be an empty string, as we are automation an app.
		    capabilities.setCapability("browserName", "");
		    //driver object with new Url and Capabilities
			driver = new AndroidDriver&lt;MobileElement;(new URL(, capabilities);
		    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);		   
		    driver.findElement(By.xpath ("//android.view.View[@content-desc='Hello.Sign inSign inHello. Link']")).click();
		    driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);		    
		    driver.findElement(By.xpath ("//android.widget.EditText[@index='0']")).sendKeys("");
		    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		    driver.findElement(By.xpath ("//android.widget.EditText[@bounds='[101,188][499,231]']")).sendKeys("yyyzzz");
		    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);	    
		    driver.findElement(By.xpath ("//android.widget.Button[@content-disc='Submit']")).click();		   

When the above Script is executed, Amazon application will be launched on the real device and a list of messages will be displayed in the Appium console.

Important commands:

1) To kill adb server:

adb kill-server

2) To start adb server:

adb start-server

3) To set JAVA_Home Path as well ANDROID_Home Path

open .bash_profile

4) To get package name and android Launcher name in apk (another way)

aapt dump badging <path to the apk>.apk name

Ex- aapt dump badging

5) To install apk in real device

adb install <apk path>.apk name

6) To uninstall apk in real device

adb uninstall <app_package_name>
Ex– adb uninstall

Limitations of Appium:

  • It does not support Android API level less than 17
  • Toast messages are not supported
  • Script execution on IOS platform is very slow
  • Gestures support is limited

Challenges faced while working with Appium:

#1) To get the launcher activity name, which is required to launch the application, many methods can be followed like an extra apk named “apkInfo” needs to be installed, certain lines of code have to be written etc .But, in this document, the following command is used to get the launcher activity name.

i.e.  aapt dump badging <path to the apk>.apk name

#2) During setup in android SDK manager we need to focus on the following packages that have to be uninstalled. Otherwise, application will not launch


#3) Especially on MAC we need to setup Java_HomePath and Android HomePath in .bash_profile so that it is not required to setup again and again.

#4) Launching the application using Emulator consumes more time compared to a real device. Hence, use of a real device is recommended.


Everybody knows how mobile devices and their applications are increasing. These mobile applications work on multiple platforms. Appium is a very good tool for mobile automation. Lots of organizations prefer it for its simplicity, ease of use and robustness.

Personally, I have worked with it and I am satisfied.

About the author: This is a guest post written for STH by Bikram Badatya and reviewed by Vivek Babu Gondi (QA Manager).

If you have any questions about this Appium tutorial, feel free to post in comments below.

44 Comments on “Appium Tool for Automation Testing of Android Apps on an iOS System

  1. Nice tutorial.

    Could you please post appium tutorial on How to Perform Automation Testing of iOS Apps on an iOS System or Windows

  2. finally someone shared the appium related posts here..

    please share the detailed tutorial for android apps mobile test automation

  3. good to see appium tutorial. please share more such tutorials.

    do you have mobile app testing training?

  4. Great to see . It would be great if some thing on iOS app

  5. Great to see this tutorials.This is really helpful with MAC OS.This tutorial I was finding long back.

  6. Very clearly written and understaning.I had failed long back by trying Android Testing with MAC os.But really this tutorials will helpful to me.many many thanks to the Author.

  7. very useful and clearly written

  8. Outstanding Article.very useful for software testing folks.

  9. thanks to is quite helpful to me

  10. fabulous Article.very helpful to beginner level.
    Thanks Author

  11. It’s quite different.very helpful to testing android.Good luck.I am very happy by this

  12. Finaly someone shared Appium Testing Article.Thanks to Author Mr.Bikram

  13. Learning Article for Entry Level Test Engineers.Good thought.

  14. Valuable article.Completely I read.keep it up the Author Mr.Bikram

  15. Thanks, this tutorial is very usefull to me

  16. its too nice article

  17. Thanks,very helpful

  18. after long time i am seeing an in-detailed article on Appium.thanks to author

  19. nice article but try to execute it out deeply

  20. Nice article Bikram.very useful.You did a great job.keep it up my friend

  21. Very Useful Article,Each step has been Explained in detail…Thank you for sharing it Mr.Bikram

  22. Wonderful article !!! I liked the complete article…. great written,Thanks for all the information you have provided… Keep updating more articles …. :-)

    • Thanks Luisha For your comments.

  23. Thanks All of you for your support and encourage.I will be updating some more articles.Once again thanks for your coopration.

  24. Thanks all of your positive feedback. It will encourage me to do same in future. I am very happy by getting feedbacks at high.Definitely I will try to improve myself in next article.I will keep on posting some more important articles.Once again thanks to all readers and Team STH.

  25. @Sravya,First of all Thanks.Definitly I will try to post related to IOS apps.

  26. @Josh,Definitely I will try for ios apps.Thanks for your appreciation.

  27. very good achievement innovation should be der ,hope u ill keep it up ..

  28. Brilliant job bikarm this is exactly what i was looking,this article will be very helpful for evry1 to learn easily as it is explained in very detailed manner..

  29. Nic one well, achievement really I don’t understand BT well done too.

  30. Very nice tutorial.Really well explained.

  31. @Sourajya, will encourage me to do better next time.

  32. Really well explained.I went through it.Thanks to Author Mr.Bikram for this topic.

  33. I am new to mobile automation , i have a query how you find out the xpath in mobile.

    • can use UIautomatorViewer which I already mentioned in this article

  34. Hello Bikram, This is tutorial is very helpful. I have an Interview tomorrow. Can you please help me with some brief training.

  35. @supriya,Thanks.sorry within tomorrow it’s not possible to further training on it. I will try later on.

  36. It’s very beautiful article. It helped me a lot. Thanks Author

  37. Nice tutorial.well explained

  38. Very nice and useful article Bikram…keep up the good work..

  39. Great insights related to the Appium. I would also suggest to experience one more user-friendly tool named TestingWhiz, which is already integrated with Appium for automating maobile apps, mostly related to the android apps.

  40. Amazing Article.It is very helpful to entry level candidates.

  41. hi for amazon app above package name and activity name is not working. can u please suggest

  42. DesiredCapabilities dc=new DesiredCapabilities();
    //dc.setCapability(“automationName”, “uiautomator2”);
    dc.setCapability(“deviceName”, “0123456789ABCDEF”);
    dc.setCapability(“PlatformName”, “android”);
    dc.setCapability(“PlatformVersion”, “4.4.2”);
    //provide app details
    dc.setCapability(“appPackage”, “”);
    dc.setCapability(“appActivity”, “”);
    but iam getting error like An unknown server-side error occurred while processing the command. Original error: Error occured while starting App. Original error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity (WARNING: The server did not provide any stacktrace information)

Leave a Comment