How to Setup and Automate iOS mobile application using Appium in Mac?


Work Flow of Appium

As discussed in the “How to Automate Android Mobile Application using Appium?” posting, Appium test script written in IDE will interact with the Appium Server which is nothing but the node server with the specified IP address and port number. Node server again passes the request to mobile devices or emulator using the uiautomation in Mac. All the UI elements associated with the mobile application can be controlled by using the appium client which is nothing but the derived one of selenium.

The following information is going to explain about the iOS application automation using Appium + TestNG + Core Java in Mac. Please note, this posting going to explain the iOS automation using the .APP file generated from the xcode project and all the automation testing happened using iPhone simulator.

How to setup Appium in Mac?

The following pre-requisites make it available at your end before start setting up Appium in Mac;

  1. Latest JDK (Pre-installed in most of the Mac)
  2. Appium.dmg for Mac
  3. Latest Eclipse IDE for Mac
  4. Source code of iOS app (xcode project)

Once the above pre-requisite is ready, start writing the test scripts in the newly created class file under java project by mapping the external dependencies of JAR files (Selenium & Appium client)

Now, we can see the above pre-requisite information in an elaborate way;

Pre-requisite 1:

Ensure the Java installation in the command prompt by entering java -version based on the below screenshot;

Java Installation Verification

Pre-requisite 2:

Download the Appium Installer from and install the dmg file in your Mac;

Ensure Appium is successfully installed and running based on the below screenshot;


Ensure the below settings in the Appium server;

General settings of Appium server

Pre-requisite 3:

Download and install the Eclipse IDE from

TestNG should be downloaded from Eclipse market place and integrate with Eclipse IDE based on the below screenshot;

Go to help menu in Eclipse IDE and install the TestNG from Available software option;

How to integrate TestNG with Eclipse

Pre-requisite 4:

Get the source code(sample project) from the github using the URL and download the zip file;

  • Unzip the file and click the .xcodeproj file associated with the folder
  • Select the build deployment target based on the available SDK mapped in the xcode

Selecting deployment target in xcode

  • Select the appropriate simulator in XCODE IDE to run the test application based on the below screenshot;

Selecting simulator in XCODE

Go to the terminal window available in the ‘Applications’ to build the source code without any errors and it will generate the .APP file for automating the same using Appium;

Go to the source code location in the terminal windows and build based on the following command as mentioned in the screenshot;

Generate app file

You will be getting the below succeeded message if there is no compilation or run time errors associated with the source code.

Build succeded

Ensure .APP file has been generated under the Downloads -> ios-uicatalog-master -> build -> Release-iphonesimulator

App file verification

All the pre-requisites are ready at our end and now coming to the script preparation for automating an iOS mobile application.

1. Create a java project in Eclipse IDE as AppiumDemo

New Java Project

2. Create a new package as appium.test(your own name) and class as AppiumTest(your own name) based on the below screenshot;

New Java class

3. Now add the script in the file in Eclipse IDE;

Before entering in to the script preparation, I would like to highlight the importance of Inspector option available in the Appium server;

It will help us to trace the mobile elements, which is used for triggering the user actions like click, enter text etc.


Go to Eclipse IDE –> Project –> Properties –> Select ‘Java Build Path’ in left pane and select the ‘Libraries’ tab and select the ‘Add External Jars…’ to map all the dependencies jar as mentioned below;

Selenium supporting jars from (Java)

Appium client libraries jars from (Java)

Add the selenium-java-2.47.1.jar and all jar files available in the libs folder and enable the same based on the below screenshot.

Adding external libraries(JAR)

Selecting the JAR added in libraries tab

Everything is ready and we need to map the generated .APP file in the Appium server to trigger the user actions in the iOS app installed in the simulator.

Selecting .APP file in Appium Server

Launch the Appium server and it will start to run by invoking the iPhone simulator and the .APP file will be showing based on the below screenshot. Please quit the simulator in which while running script in Eclipse IDE, it will automatically invoke the simulator using Appium.

App in Simulator screen

Add the below script and run the test script in the Eclipse IDE;

package appium.test;

import io.appium.java_client.ios.IOSDriver;


import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class AppiumTest {
 private IOSDriver driver;
 public void setUp() throws MalformedURLException {
 DesiredCapabilities caps = new DesiredCapabilities();
 caps.setCapability("platformName", "iOS");
 caps.setCapability("platformVersion", "7.1"); 
 caps.setCapability("deviceName", "iPhone Simulator"); 
// caps.setCapability("bundleid", "");
 caps.setCapability("app", "/Users/gopikannan/Downloads/ios-uicatalog-master/build/Release-iphonesimulator/"); 
 driver = new IOSDriver(new URL(""), caps);
 public void testiOS() throws InterruptedException, IOException {
 File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
 FileUtils.copyFile(scrFile, new File("/Users/gopikannan/Downloads/g2.jpg"));
 public void tearDown() {

Go to Eclipse IDE and right click the mouse button in script window by selecting the ‘Run as’ option and again select the TestNG Test’ as mentioned in the below screenshot;

How to run test script

That’s it!!! You script will be executed in the mobile application installed in the iPhone Simulator.

Please check the below Post/URL to start automating the latest iOS 10 and above including xcode 8 and above;

36 thoughts on “How to Setup and Automate iOS mobile application using Appium in Mac?

  1. Hi ,

    I am getting an error “xcodebuild: error: ‘project.pbxproj’ is not a project file.” while trying to build the source code.Pls help


      1. I used the exact command that you mentioned in the blog.But when I tried building the app from exode itself I have got succesful build.

        But now I am facing issues while running the Javascript. Its giving an error saying element not found.
        Also in Appium, the application Bundle is not getting populated.How can we get this


  2. In this post is used for execution. Is it possible to automate E-Commerce applications(ex: Flipkart)??
    If possible where can we find Source Code of application.


    1. Hi Avinash, You cannot get source code for flipkart or any other app unless it is available in github or some other open repository. We are having provision to break the android apk file to get the source code but the same provision is not available for iOS APP/IPA file due to it’s security limitation. Thanks


  3. Could not find a device to launch. You requested ‘iPhone (10.2 Simulator)’, but the available devices were: [“iPad Air (10.2) [AE98503C-F5E4-48B3-905F-541CE627BC19] (Simulator)”,”iPad Air 2 (10.2) [6652043B-664F-453E-9A33-393B51A79917] (Simulator)”,”iPad Pro (12.9 inch) (10.2) [A48F3CAE-9A38-48CD-AF1D-2E53B8AA977D] (Simulator)”,”iPad Pro (9.7 inch) (10.2) [478B8976-3277-4802-A0DC-B9ACCAB57CAB] (Simulator)”,”iPad Retina (10.2) [96E761C0-0DBF-4288-BC38-A56AB437DE02] (Simulator)”,”iPhone 5 (10.2) [B17E14A6-3F98-441D-A49E-1753AD1BEC29] (Simulator)”,”iPhone 5s (10.2) [FA2DAF81-DCCD-42FB-897E-A0550260252F] (Simulator)”,”iPhone 6 (10.2) [4F243CA5-696D-4E05-A5A4-52D821957400] (Simulator)”,”iPhone 6 Plus (10.2) [53901C70-1A70-4273-A592-F3A917475643] (Simulator)”,”iPhone 6s (10.2) [6C25324E-EA11-4514-8302-002FB61D2648] (Simulator)”,”iPhone 6s Plus (10.2) [E535C903-6C5F-4D6C-8CDB-6FF812E65DC8] (Simulator)”,”iPhone 7 (10.2) [405EBE73-329A-439F-B206-7C7CC03E6393] (Simulator)”,”iPhone 7 (10.2) + Apple Watch Series 2 – 38mm (3.1) [4EB80F2D-9CAC-4FF2-96D6-3A24F1026594] (Simulator)”,”iPhone 7 Plus (10.2) [B95CA6A3-B395-4E09-B9B8-5F87F29E829D] (Simulator)”,”iPhone 7 Plus (10.2) + Apple Watch Series 2 – 42mm (3.1) [CCD15041-FB54-4AF7-84CC-8A754E89C8DC] (Simulator)”,”iPhone SE (10.2) [9CEEED0C-3CC8-49FE-B91F-8D40E25AD574] (Simulator)”]

    How to deal with this? Thx


    1. Where you getting this exception? 1. While running your script in eclipse? If so share me your capabilities section OR 2. While try to build the source code to build .APP? 3. What is the xcode version you are using?

      Please tell me to proceed for further diagnosis.


    1. Yes, appium will launch the target mobile application in the simulator. Please note now the capabilities & code structure section has been changed for iOS > 9.3 onwards, I will post a new blog about the iOS 10 mobile application automation which will be using XCUITEST instead of UIAUTOMATION. Keep watching the space.


  4. Hi Gopi,

    info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier

    I am getting this error on launching inspector and the app crashes on starting up.

    Please help me on this to proceed further 🙂


  5. Hi,
    I have installed appium 1.4.13 and my Mac OS version is 10.12.4. My appium check is successful.

    However, when I try to launch the appium for inspecting android app, I am unable to get the status. It remains unresponding. These are my logs:

    Launching Appium with command: ‘/Applications/’ lib/server/main.js –command-timeout “7200” –debug-log-spacing –automation-name “Appium” –platform-name “Android” –platform-version “4.4” –app “/Users/sandhya_velu/Downloads/My Knovel.apk” –app-pkg “com.elsevier.rnd.myknoveltogo” –app-activity “com.elsevier.rnd.myknoveltogo.MyKnovelToGo” –app-wait-package “com.elsevier.rnd.myknoveltogo” –device-name “07cd4a03”

    info: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a)

    info: Appium REST http interface listener started on

    info: [debug] Non-default server args: {“app”:”/Users/sandhya_velu/Downloads/My Knovel.apk”,”androidPackage”:”com.elsevier.rnd.myknoveltogo”,”androidActivity”:”com.elsevier.rnd.myknoveltogo.MyKnovelToGo”,”androidWaitPackage”:”com.elsevier.rnd.myknoveltogo”,”deviceName”:”07cd4a03″,”platformName”:”Android”,”platformVersion”:”4.4″,”automationName”:”Appium”,”defaultCommandTimeout”:7200,”debugLogSpacing”:true}

    info: Console LogLevel: debug

    It is not proceeding further. Please help me on this


    1. I have used latest version of appium 1.5.3, still I am unable to launch the server. Please find the server logs

      Launching Appium with command: ‘/Applications/’ appium/build/lib/main.js –debug-log-spacing –platform-version “8.1” –platform-name “iOS” –app “/Users/sandhya_velu/Downloads/ios-uicatalog-master/build/Release-iphonesimulator/” –show-ios-log –default-device

      [Appium] Welcome to Appium v1.5.3

      [Appium] Non-default server args:

      [Appium] defaultDevice: true
      [Appium] debugLogSpacing: true
      [Appium] platformName: ‘iOS’
      [Appium] platformVersion: ‘8.1’
      [Appium] app: ‘/Users/sandhya_velu/Downloads/ios-uicatalog-master/build/Release-iphonesimulator/’
      [Appium] showIOSLog: true
      [Appium] Deprecated server args:
      [Appium] –platform-name => –default-capabilities ‘{“platformName”:”iOS”}’
      [Appium] –platform-version => –default-capabilities ‘{“platformVersion”:”8.1″}’
      [Appium] –app => –default-capabilities ‘{“app”:”/Users/sandhya_velu/Downloads/ios-uicatalog-master/build/Release-iphonesimulator/”}’
      [Appium] –show-ios-log => –default-capabilities ‘{“showIOSLog”:true}’
      [Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:

      [Appium] platformName: ‘iOS’

      [Appium] platformVersion: ‘8.1’
      [Appium] app: ‘/Users/sandhya_velu/Downloads/ios-uicatalog-master/build/Release-iphonesimulator/’
      [Appium] showIOSLog: true

      [Appium] Appium REST http interface listener started on


  6. Hi,
    My launching problem is solved. Able to launch successfully. Thanks 🙂

    However, appium 1.5.3 and Xcode 8.3 is not compatible. I downloaded “appium-xcuitest-driver-master”. I donno how to use it. Kindly help me on this



      1. HI,
        Followed the above instructions and script executes successfully. Thank you! 🙂

        Also, I need steps to automate iOS application using ipa file. Kindly help me on this.



      2. Nice to see your script executed successfully in Mac.

        Instead of giving the .APP file location path, you just give the .IPA file location path in the “app” capability section.

        Ensure the simulator/iPhone device id information is loaded in the target .IPA file by the development team.


  7. Hi Gopi ,

    I am trying to run my test on Simulator .
    I am using this capabilities

    File app = new File(“/Users/xcodeclub/Desktop/”);

    DesiredCapabilities capabilities = new DesiredCapabilities();

    capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, “”);

    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “8.1”);

    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “iPhone 6”);

    capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());

    IOSDriver driver = new IOSDriver(new URL(“”), capabilities);

    I am getting error badparameter request from Appium


    1. Please follow the capabilities part as I mentioned in my blog page; You should give the .app file instead of .zip

      public void setUp() throws MalformedURLException {
      DesiredCapabilities caps = new DesiredCapabilities();
      caps.setCapability(“platformName”, “iOS”);
      caps.setCapability(“platformVersion”, “7.1”);
      caps.setCapability(“deviceName”, “iPhone Simulator”);
      caps.setCapability(“app”, “/Users/gopikannan/Downloads/ios-uicatalog-master/build/Release-iphonesimulator/”);
      driver = new IOSDriver(new URL(“”), caps);


      1. I have tried with .app as well and did some other fixes as well however now app is not getting installed on my simulator and getting wd connection errors .after 15 mins trial I get error in eclipse that didn’t got response from server

        Thanks for your quick response


    1. Hi Ajit Gour,

      Unfortunately it will not support greater than iOS 9 incuding xcode > 8 but I will be posting same setup instructions for iOS 10 and Xcode 8+ before this ween end.

      Apple deprecated UIAutomation support from iOS 9+ onwards. Now XCUITest is the only way to automate the latest iOS with xcode 8+.

      Please keep watching.


  8. Hi Sir,
    by using Appium i am able to access my app but just want to open app using java code, i a getting the below exceptions please suggst me.

    FAILED CONFIGURATION: @BeforeMethod setUp
    org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to [/] failed: Connection refused (Connection refused)
    Build info: version: ‘3.5.0’, revision: ‘8def36e068’, time: ‘2017-08-10T23:00:22.093Z’
    System info: host: ‘admins-iMac-2.local’, ip: ‘fe80:0:0:0:1c87:e13a:607a:c31%en0’, ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.12.6’, java.version: ‘1.8.0_144’
    Driver info: driver.version: IOSDriver
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(
    at org.openqa.selenium.remote.RemoteWebDriver.execute(
    at io.appium.java_client.DefaultGenericMobileDriver.execute(
    at io.appium.java_client.AppiumDriver.execute(
    at io.appium.java_client.ios.IOSDriver.execute(
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(
    at org.openqa.selenium.remote.RemoteWebDriver.(
    at io.appium.java_client.DefaultGenericMobileDriver.(
    at io.appium.java_client.AppiumDriver.(
    at io.appium.java_client.AppiumDriver.(
    at io.appium.java_client.ios.IOSDriver.(
    at Appium.AppiumTest.setUp(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(


    1. Appium Client not able to establish connection with the Appium Server based on the IP Address

      Try to change the default IP address and port number as in Appium Server and start the Appium desktop server, now try to run your client specific code

      Ensure Appium console window showing the exception information as expected.


      1. But one more thing ,,,,,,,

        I want to run appium using cmd line.
        How i can ? Can you explain some?

        thanks i advance……


    2. Might be firewall or antivirus in your machine blocking the connection. Temporarily disable firewall and antivirus in your machine and try to run your Java code(Appium client)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s