XCUITest Driver for iOS

Go back to tutorial

XCUITest Driver for iOS

XCUITest driver is the primary support for automating Appium’s  iOS apps. Moreover, this driver leverages Apple’s XCUITest libraries in order to facilitate automation of your app. Further, this access to XCUITest is mediated by the WebDriverAgent server. WDA is a WebDriver-compatible server that runs in the context of an iOS simulator or device and exposes the XCUITest API. Further, Appium’s XCUITest driver manages WDA as a subprocess opaque to the Appium user. Also. the development of the XCUITest driver happens at the appium-xcuitest-driver repo.

Requirements and Support – XCUITest driver

In addition to Appium’s general requirements, following are the requirement to use XCUITest driver

  • Firstly, the Apple’s XCUITest library is only available on iOS simulators and devices that are running iOS 9.3 or higher.
  • Secondly,you should have a Mac computer with macOS 10.11 or 10.12 is required.
  • Thirdly, Xcode 7 or higher is required.
  • Also, the XCUITest driver was available in Appium starting with Appium 1.6.
  • Lastly, for correct functioning of the driver, additional system libraries are required.

Using XCUITest driver

At first, the way to start a session using the XCUITest driver is by including the automationName capability in your new session request, with the value XCUITest. Also, you must also include appropriate platformName, platformVersion, deviceName, and app capabilities, at a minimum.

Also, remember, the platformName should be iOS for iPhone or iPad. tvOS devices are available if the platformName is tvOS.

  • iOS json { “automationName”: “XCUITest”, “platformName”: “iOS”, “platformVersion”: “12.2”, “deviceName”: “iPhone 8”, … }
  • tvOS json { “automationName”: “XCUITest”, “platformName”: “tvOS”, “platformVersion”: “12.2”, “deviceName”: “Apple TV”, … }

 

External dependencies

In addition, to the git submodules, this package depends on libimobiledevice to do certain things. Therefore, you should install it with Homebrew,

brew install libimobiledevice –HEAD  # install from HEAD to get important updates

brew install ideviceinstaller         # only works for ios 9. for ios 10

Further, there is also a dependency, made necessary by Facebook’s WebDriverAgent, for the Carthage dependency manager. In case, you do not have Carthage on your system, it can also be installed with Homebrew,

brew install carthage

ideviceinstaller doesn’t work with iOS 10 yet. So we need to install ios-deploy

npm install -g ios-deploy

Capabilities

XCUITest driver supports a number of standard Appium capabilities, but with additional set of capabilities that modulate the behavior of the driver. Therefore, in order to automate Safari instead of your own application, leave the app capability empty and instead set the browserName capability to Safari.

  • Commands: In order to see the various commands Appium supports, and specifically for information on how the commands map to behaviors for the XCUITest driver.
  • Basic Setup: It is recommend to use of Homebrew for installing system dependencies. Further, you must ensure that you have Appium’s general dependencies installed and configured: bash brew install carthage

 

Real Device Setup

Now, the process of automating a real device with XCUITest is considerably more complicated, due to Apple’s restrictions around running apps on real devices. Therefore, after set up, running a session on a real device is achieved by using the desired capabilities including app or bundleId and udid

 

Enrich your profile and become Job Ready. Practice and Prepare for Mobile Testing (Appium) Exam Now!

Get expert advice and hundreds of Free Test – Try Mobile Testing (Appium) Practice Questions Now!

Go back to tutorial

Get industry recognized certification – Contact us

Menu