Drive a real iOS Device with Appium 2 (XCUITest)

How to run your Appium 2 scripts on a physical device

Courtney Zhan

--

First of all, this can be a frustrating experience for first-timers (like me), as there are many steps and Apple’s proprietary process is involved.

This article will walk through the steps I used to run an Appium 2 script for my own app on a physical iOS device. See this article if you are using a simulator instead.

· Before Starting
Hardware
Software: your iOS app
Code Signing Certificate, requires Apple Developer Account
·
Preparation
Task 1. Enabling Developer Mode on iPhone
Task 2. Build your iOS app with the correct code signing
Task 3. Export your iOS app to an .ipa file
·
Automate it with Appium 2
Attempt to run Appium Automation Script
Run Successfully

Before Starting

Hardware

There are two physical devices involved:

  1. A macOS computer with Xcode installed
    I refer to it as iMac. Xcode is to use to build an iOS app that I want to automate.
  2. An iOS device, e.g. iPhone or iPad
    I will use an iPhone 13 in the exercise.

Of course, these two must be connected (via USB). Also make sure that:

  • The iMac and the iPhone trust each other.
  • The iPhone is in Developer mode (see Task 1 below).

Software: your iOS app

Obviously, this can be a pre-packaged app (in .ipa format) or your own app under development (e.g. in Xcode).

Code Signing Certificate, requires Apple Developer Account

Code Signing Certificate is to ensure the app’s integrity, using a certificate issued by Apple. This is not free, you need to have a valid Apple Developer Account (costs US$99/year) to generate one.

--

--