In this chapter we will find out the prerequisites for connecting iOS real device/ Simulator with Appium 

Prerequisites for Appium on Mac:

  • To automate iOS for mobile or iPAD OS for tablets, it is must to have a Mac machine.
  • XCode should be installed properly to get the SDK files for connectivity
  • XCode should be kept upto date to get the latest iOS/iPAD OS support
  • You must have a valid Apple developer ID for provisioning profile
  • NODEjs must be installed in the device

What is WDA ?

WDA stands for WebDriverAgent. As the name says this is the bridge/agent for Appium to send or receive Proxy commands to a real device/ simulators.

WDA was developed by Facebook for their hybrid app testing. Later it was acquired by Appium and now it is managed by Appium team. Still the WDA’s bundle ID is “com.facebook.bundleID” with few facebook libraries imported. WDA is designed using Objective C you can see the code by opening the WDA framework in XCode.

Don’t get confuse with XCode and XPath. Usually happens for me while talking J just kidding…

It is a good practice to change the WDA bundleID from “com.facebook” to some generic name like “com.UIAutomation” or something. Else if you are using any client provided enterprise Apple DEV ID for compilation, then you can see facebook.com all over bundleID’s which may create IT auditing issues. Don’t worry changing BundleID cannot stop you from compiling or building the WDA codebase.

How to download WDA ?

  1. WDA comes with Appium desktop, so no need to download separately
  2. You can find WDA as a framework and not as an app.
  3. It is our responsibility to compile the WDA framework and installing it in the device for test
  4. Once installed make sure you have given trust access for the WDA from “Device and Management” option from General settings screen. Else it will be considered as an untrustworthy app and it will become inaccessible from Appium. (Only for Real devices)

Where to find the WDA framework in Mac machine?

  1. Go to Finder and Applications,
  2. Search the Appium application and take right click on Appium icon
  3. Take “Show Package Contents” option from right click menu
  4. Navigate to the path “Contents/Resources/app/node_modules/appium-webdriveragent/”
  5. Open the file “WebDriverAgent.xcodeproj” in Xcode.

How to compile the WebDriverAgent.xcodeproj in XCode ?

Open the file WebDriverAgent.xcodeproj in XCode, so that you can see the WDA program in XCode like below,

Make sure you have selected the proper device from the “Devices” list

Make sure you are using your AppleID on build settings under “Provisioning Profile” on xcode version <=10 and “Signing & Capabilities” on xcode version >=11. Now, go to “Product” click on “Build”

I have selected the option “iPad Pro (12.9 inch)(3rd Generation) simulator, it means I’m going to install WDA on simulator now

If you face any compilation issues you can find that in the left hand side menu like this

You can ignore the warnings but not error’s (please refer the topic “Common WDA compilation issues” below if you face any error) and now Once Build is successfully compiled, go to “Product” and take option “Test”. This option will start the Simulator and install WDA as an App

Now the selected simulator will be opened and the app will start installing on the simulator

WDA installed successfully on the Simulator

Limitation in using Appium on MAC Machine?

As we all know Appium is a platform independent tool. We can run Appium on Windows/ Mac/ Linux. But yes there are few limitations when it comes to device platform.

  1. Using Appium, you can automate Android phones using any Windows/ Mac machine(Android SDK is must).
  2. You cannot automate iOS application using Appium from Windows/Linux based machines.

Why Automating iOS devices are not possible with a Windows machine?

There are lot of reasons we can list out, few most common reasons are

  • Windows by default will not have support for advanced iOS operations. You can perform only basic file data transfer option but installation of any app or debugging options are not available from Windows.
  • XCode which is a commonly used SDK for iOS app. XCode support is not available for windows-based OS. 
  • Without XCode you cannot install WDA (WebDriver Agent) to iOS devices, so from windows it is impossible.

Commonly facing WDA installation/ compilation issues:

  1. Provisioning Profile:

If you are using your personal Apple development ID for more than 2 devices then you will definitely face provisioning profile issues while compiling. The solution is either you need to untag few devices from your apple dev account or you need to change the apple ID in your app build settings. FYI… Provisioning profile is applicable only for real devices

  • ‘RoutingHTTPServer/RoutingConnection.h’ file not found

For the first time if you are building WDA then you have to face this issue for sure. This is happening because of missing “bootstrap” script configuration. To overcome this issue, open Terminal and open the path where WDA project file exist, (“/Applications/Appium.app/Contents/Resources/app/node_modules/appium-webdriveragent/”) and type the command “./Scripts/bootstrap.sh -d”. This command will help you to resolve the h file not found issue.

  • CocoaAsyncSocket.h not found

Again a common and must face issue while compiling WDA, This needs no action to be taken. Just close the XCode and open the WDA project again.

This issue may come if you have installed Appium CLI. Because the CarthageKit that installed as a part of Appium CLI may cause issue. If restarting XCode didn’t solve the issue then uninsall/remove CarthageKit from terminal using the below command

rm -rf ~/Library/Caches/org.carthage.CarthageKit

One more major issue/concern in WDA is, auto clean-up while initiating the Appium connectivity. We will discuss about this topic in upcoming sessions.

Blog Contributors:

Author:  Ragavendran

Ragav, having 10+ years of testing experience on which 7 years of rich experience in automation using UFT, Selenium (Java/Python). Expertise in Web and Mobile automation testing using Appium.

https://www.linkedin.com/in/ragavendra

Reviewer: Naveen Khunteta 

https://www.linkedin.com/in/naveenkhunteta