Appium - Mobile test automation on a real device

If you are looking to perform test automation on a real device (iPhone in my case) and you have had problems with the documentation on the official Appium website , the following post will help you for sure:


  1. Apple account with valid apple ID 
  2. Download and Install Eclipse on your Mac – A link that might help you with the installation process
  3. Download and Install Xcode
  4. Download Selenium Jars for java from the Selenium website
  5. Download the java client libraries from
  6. Download and install appiumD
    1. download the latest version from
    2. Mount the disk image.
    3.  Drag to your Applications folder
  7. Download and Install brew (The missing package manager for OS X)
    1. It's on the bottom of the Homebrew homepage. (Yeah, it would be helpful if it was listed at the top, instead.)
    2. From a Terminal prompt:  ruby -e "$(curl -fsSL"
  8. Tip: (Optional) – Install Oh my zsh for a better shell experience
  9. Your apple id has access to a valid iOS Developer portal

Important points to note:

  1. Appium uses ‘Appium Inspector’ to view the elements similar to what we have as ‘uiautomatorviewer’ tool to view UI components in Android in UI Automator. You can access elements using name , xpath or tagName as visible through appium inspector
  2. Appium Inspector can be launched by clicking on the blue ‘i’ button besides ‘Launch’ button from appium app.
Setup and Execution:

The core of what most of the Appium help posts are missing:

  1. Find UDID of the iphone:
  2. Turn on web inspector on iOS device (**settings > safari > advanced**, only for iOS 6.0 and up)
  3. Note:1.       To be able to run your tests against mobile Safari we use the SafariLauncher App to launch Safari. Once Safari has been launched the Remote Debugger automatically connects using the ios-webkit-debug-proxy.
  4. Setup: Before you can run your tests against Safari on a real device you will need to:   Have the ios-webkit-debug-proxy installed, running and listening on port 27753 
  5. Note: When executing against a real iOS device appium is unable to access the web view directly. Therefore the connection has to be established through the USB lead. To establish this connection we use the ios-webkit-debugger-proxy.
  6. To install the latest tagged version of the ios-webkit-debug-proxy using brew, run the following commands in the terminal:
    1.  ruby -e "$(curl –fsSL"
    2. brew update
    3. brew install ios-webkit-debug-proxy
  7. Once installed you can start the proxy with the following command:
    1. Change the udid to be the udid of the attached device and make sure to set the port to 27753 as that is the port the remote-debugger uses:
    2. > ios_webkit_debug_proxy -c 0e4b2f612b65e98c1d07d22ee08678130d345429:27753 –
  8. On Mac                                    i.      Connect your device to your Mac.
  9.                                                              ii.      In the Devices organizer under Devices, select your device.
                                                                iii.      Click the “Use for Development” or “Add to Member Center” button.
                                                               iv.      If the device was previously used for development, the “Use for Development” button does not appear. If this happens, click “Add to Member Center” at the bottom of the window instead.
                                                                 v.      In the team dialog that appears, select the checkbox next to your account name, and click Choose.
                                                               vi.      If a Certificate Not Found dialog appears, click Request.
  10. Create a provisioning profile that can be used to deploy the SafariLauncherApp.
  11. Create a new App Id and select the WildCard App ID option and set it to “*”
    2.       You can only create application IDs in the iOS developer portal. Once you're logged in, choose the "Certificates, Identifiers & Profiles" link:
    3.       On the next screen, choose the "Identifiers" option on the left:
    4.       Now you can click the "+" icon near the top right to create a new App ID:
    5.       The first thing you're asked to do is provide an App ID description:
    6.       Choose an App ID Suffix as “*”
    7.       Complete and submit to get a message – “This App ID is now registered to your account and can be used in your provisioning profiles
  12. Create a new Development Profile and for App Id select the one created in step 1.
    1.       Click on Add new Provisioning Profile
    2.       Choose iOS App Development option
    3.       for App Id select the one created in step 1.
    4.       Select your certificate(s) and device(s) and click next.
    5.       Set the profile name and generate the profile.
    6.       Download the profile and open it with a text editor.
Make sure you either use XCode and install ios --real-safari –launcher on your device:
  1.                                                                i.      git clone
                                                                 ii.      install npm using brew – brew install npm
                                                                iii.      cd appium
                                                               iv.      ./ --ios --real-safari –launcher
  2. If unable to install. Open the git project using XCode - build and run the installation
  1. Make sure you have a new terminal and run: ios_webkit_debug_proxy -c 0e4b2f612b65e98c1d07d22ee08678130d345429:27753 –d
  2. Open another terminal and start the appium server:                                                              
                                                                                  i.      cd appium
                                                                                 ii.      node . -U --app ‘safari’

You are good to start writing your selenium webdriver scripts now

                               Sample script in Java(JUnit 4)

package com.test.appium;
import java.util.Iterator;
import java.util.Set;
import org.junit.After;
import org.junit.Before;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class FirstTestCase {
public WebDriver driver = null;
public void setUp() throws Exception {
// set up appium
DesiredCapabilities capabilities = new DesiredCapabilities();
System.out.println("Before App launched");
driver = new RemoteWebDriver(new URL(""),capabilities);
System.out.println("App launched");
public void tearDown() throws Exception {
public void testCases() throws InterruptedException {
WebElement login = driver.findElement(By.xpath("//*[@class='login_button']"));;
int itr=2;
String windowHandle=null;
Set parentWindowHandle = driver.getWindowHandles(); // save the current window handle.
  Iterator windowIterator = parentWindowHandle.iterator();
  while(windowIterator.hasNext() && itr!=0) {
    windowHandle =;
  WebElement username = driver.findElement(By.xpath("//*[@id='username']"));


  1. Thank you for sharing the information.It is very interesting blog on Appium

  2. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Appium.

  3. Usually I do not read post on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Great work admin.Keep update more blog.
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies

  4. These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.
    Mobile App Development Company


Post a Comment

Popular posts from this blog

XPATH for IE / internet explorer

RPA - Blue Prism, OpenSpan, Automation Anywhere vs UIPath