Mobile Automation Setup Guide for iOS with Appium(C#)

Mohammad Saad Saghir
4 min readApr 15, 2022

Prerequisites for iOS Automation Setup on Mac

  • Xcode
  • Visual Studio for IDE
  • Appium Sever GUI & Appium Inspector
  • Android Studio for SDK
  • SDK & JDK Installation and setting up environment variables
  • Homebrew
  • Node Dependencies
  • iOS Real Device Setup
  • WebDriver Agent
  1. Install Xcode and Xcode Command Line Tools

a. You can download Xcode from App Store/Command Line Tools from terminal

$ xcode-select — install

b. Open Xcode a Preferences -> Accounts -> Add Apple ID

Xcode
Command Line Tools

2. Install Visual Studio

Visual Studio

3. Install Appium Desktop (Server GUI + Inspector)

4. Install Android Studio + Android SDK

5. Install JDK

6. Install Homebrew

Open Terminal & Run the command:

$ /bin/bash -c “$(curl -fsSL -k https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Warning: /opt/homebrew/bin is not in your PATH. Instructions on how to configure your shell for Homebrew can be found in the ‘Next steps’ section below.

Run the command:

$ echo ‘eval “$(/opt/homebrew/bin/brew shellenv)”’ >> /Users/username/.zprofile

7. Install npm

$ brew install npm

8. Install node

$ brew install node (if already installed: brew upgrade node)

9. Install Appium

$ npm install -g Appium

10. Install Appium Doctor

$ npm install appium-doctor -g

11. Install libimobiledevice

$ brew install libimobiledevice
$ brew install libimobiledevice –HEAD

12. Install carthage

$ brew install carthage

13. Install ios-deploy

$ brew install -g ios-deploy

14. Install ideviceinstaller

$ brew install ideviceinstaller

15. To check udid of Connected Devices

$ idevice_id -l

16. To check udid of all Devices (iOS Device + Xcode Simulators)

$ xcrun xctrace list devices

17. Install xcpretty

$ sudo gem install xcpretty

18. To set up Java & Android Home in mac

Open Terminal & Run the command:

$ nano ~/.zshenv

Set location of JDK & SDK path like:

$ source ~/.zshenv (To Apply Changes)

19. Let’s run appium doctor after all above configuration

Open Terminal & Run the command:

$ appium-doctor

20. Install WebDriverAgent

Open Terminal & Run the command:

$ cd /Applications/Appium\ Server\ GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent

21. Make directory in Resources folder

$ mkdir -p Resources/WebDriverAgent.bundle

Open the WebDriverAgent.xcodeproj project in xcode (you can find the project in one of the directories specified above)

For WebDriverAgentRunner & Integration App targets a Build Settings a Change Product Bundle Identifier value

From
“com.facebook.WebDriverAgentRunner”
to
“com.facebook.WebDriverAgentRunnerXXX”

Go to Signing & Capabilities a Select the Automatically Manage Signing check box a select your development team a Select your device

Open Terminal & Run the command:

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=udid’ test

22. After above configurations, Start Appium Server GUI

23. Start Appium Inspector and set desired capabilities

24. Start Session

Reference Links

  1. https://developer.apple.com/download/all/?q=Xcode
  2. https://visualstudio.microsoft.com/
  3. https://github.com/appium/appium-desktop/releases
  4. https://github.com/appium/appium-inspector/releases
  5. https://developer.android.com/studio
  6. https://www.oracle.com/java/technologies/downloads/
  7. https://brew.sh/
  8. https://formulae.brew.sh/formula/ideviceinstaller
  9. https://www.npmjs.com/package/ios-deploy
  10. https://libimobiledevice.org/

--

--

Mohammad Saad Saghir

Test Automation Specialist - Mobile 📱 | iSQI - Appium® | Mobile Automation Developer | Android | iOS | Framework | Selenium | Appium | BDD | Specflow |