Setting Up iOS Automation with Appium, Java, and WebDriverAgent

This guide details how to set up an iOS automation environment using Appium, Java, and related tools on macOS, covering system requirements, installation of Xcode, JDK, Node, Appium, WebDriverAgent, and necessary plugins, along with troubleshooting tips for successful device testing.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Setting Up iOS Automation with Appium, Java, and WebDriverAgent

The author, who usually tests Android and iOS client applications, decided to build an iOS automation environment using Appium and Java after noticing a lack of iOS regression testing.

System environment MacOS: 10.12.6 iPhone real device: iPhone 6 (iOS 10.2.1) Appium: 1.6.3 Xcode: 9.2

Environment setup steps

1. Install Xcode from the App Store.

2. Install JDK if not already present (brew install openjdk) and configure environment variables.

3. Install Node.js via Homebrew: brew node install and verify with node -v.

4. npm is installed with Node; verify with npm -v.

5. Install Appium Doctor: npm install appium-doctor -g and run appium-doctor --ios to check iOS configuration.

6. Install required plugins:

brew install libimobiledevice
brew install ideviceinstaller
brew install carthage
npm install -g ios-deploy

(note: may require fixing errors shown in the screenshot).

7. Install Appium globally: npm install -g appium.

8. Download and install the Appium Desktop client from GitHub releases .

9. Install WebDriverAgent by navigating to

/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent

and executing sudo ./Scripts/bootstrap.sh.

10. Open WebDriverAgent.xcodeproj in Xcode, configure the WebDriverAgentLib-General settings: set a unique bundle identifier and select your Apple ID team.

11. If Xcode reports directory errors, run sudo xcode-select -switch XXX (replace XXX with the correct Xcode path).

12. Install AnyProxy for traffic mocking: npm install anyproxy -g, then open http://ip:8002/fetchCrtFile on the device to install the proxy certificate.

13. Start Appium, set the Desired Capabilities (including udid obtained via Xcode), and click “Start Session”. The tested app should launch on the iPhone, indicating a successful setup.

Following these steps, the author successfully ran iOS automation scripts and verified the setup on a real device.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

iOSAutomationmobile testingXcodemacOSAppium
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.