Appium · iOS · Test automation · Mobile
Appium on Real iOS Devices: WebDriverAgent and Code Signing
Running Appium tests on a real iPhone with the XCUITest driver: preparing Xcode, signing WebDriverAgent, the capabilities you need and the most common setup errors.

On Android, real-device testing starts with a USB cable and adb. On iOS, running the first test means a short trip into Apple's code-signing world. This article walks through the points where people get stuck the first time they run Appium on a real iPhone.
Prerequisites
- macOS and Xcode: iOS automation only runs on macOS. Install Xcode, open it at least once and let it install its extra components.
- An Apple developer account: a free account can sign, but profiles must be renewed every seven days. A device farm needs a paid account.
- Developer mode on the device: on iOS 16 and later, enable Settings → Privacy & Security → Developer Mode.
- Appium and the XCUITest driver:
npm install -g appium
appium driver install xcuitest
What WebDriverAgent is and why it must be signed
The XCUITest driver installs a small test app called WebDriverAgent (WDA) on the device. WDA executes the commands Appium sends. iOS won't run unsigned apps on a real device, so you must sign WDA with your own developer team.
The smoothest way is to pass signing details as capabilities:
const capabilities = {
platformName: 'iOS',
'appium:automationName': 'XCUITest',
'appium:udid': '00008110-001A2B3C4D5E6F',
'appium:bundleId': 'com.example.app',
'appium:xcodeOrgId': 'ABCDE12345',
'appium:xcodeSigningId': 'Apple Development',
'appium:updatedWDABundleId': 'com.example.WebDriverAgentRunner',
'appium:wdaLocalPort': 8100
};
updatedWDABundleId replaces WDA's bundle id with a unique one owned by your team; the default id is registered to another team, so signing fails without it.
Trusting the developer on first run
For apps signed with a free or enterprise profile, you must trust the developer certificate on the device under Settings → General → VPN & Device Management. Skip this and WDA closes right after launching, and Appium reports "xcodebuild failed".
Speeding up session start
Rebuilding WDA for every session can take minutes. Two improvements:
usePrebuiltWDA/derivedDataPath: build WDA once and reuse that build in later sessions.- A fixed
wdaLocalPortper device: prevents port collisions between parallel iOS sessions.
Common errors
| Error | Likely cause |
|---|---|
xcodebuild failed with code 65 | Signing or profile problem; open the WDA project in Xcode and build manually to see the detailed error |
| WDA launches and closes immediately | The developer certificate isn't trusted on the device |
Could not find a device | Wrong udid or a locked device; check with xcrun xctrace list devices |
| Session starts but commands time out | Port collision or a stale WDA on the device; uninstall it and retry |
Selectors
On iOS too, the most reliable selector is the accessibility id. For complex cases, the -ios predicate string and -ios class chain strategies are much faster than XPath:
await driver.$('-ios predicate string:type == "XCUIElementTypeButton" AND name == "Pay"').click();
Most causes of flakiness are shared across platforms, so flaky Appium tests: 8 root causes applies to iOS as well.
Conclusion
Setting up real iOS devices is tedious the first time but stable once signing is right. Signing WDA with the correct team id, enabling developer mode and trust on the device, and caching the WDA build solve most of the work.


