UIAutomation Driver for iOS

Go back to tutorial

UIAutomation Driver for iOS

In general, UIAutomation Driver is DEPRECATED and should not be used unless absolutely necessary. The information in this doc may not keep up to date with reality. Further, the driver will be removed in a future version of Appium. Therefore, to begin iOS automation with Appium today, please use the XCUITest Driver instead.

But, you must remember that Appium’s former method for iOS app automation was based on UIAutomation. Moreover, the UIAutomation was one of the tools included in Apple’s Instruments profiling system, and provided a JavaScript API that ran synchronously in the context of a single app. Also, the Appium UIAutomation driver established an asynchronous, session-based WebDriver front end for this API.

Remember, the development of the UIAutomation driver is done at the appium-ios-driver repo.

What are requirements and support for UIAutomation Driver for iOS?

In addition, Appium’s general requirements include,

  • Firstly, you would require Xcode 7 or lower.
  • Secondly, iOS simulators or devices with version 9.3 or lower is also required
  • Also, all versions of Appium ship with this driver are needed.
  • Lastly, it requires correct functioning of the driver.

How to use UIAutomation Driver for iOS?

One of the ways to start a session using UIAutomation driver is to set the platformName capability in your new session request to the value of iOS. Also, you must also include appropriate platformVersion, deviceName, and app capabilities, at a minimum.

Required Capabilities

The UIAutomation driver supports a number of standard Appium capabilities, but has an additional set of capabilities that work for this driver only. Therefore, 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 UIAutomation driver.

Simulator Setup

Due to limitations of Xcode and the iOS simulator, only one simulator may be open, and automated, at any given time. Therefore, for multiple simulator support, you will need to upgrade to the XCUITest driver

Real Device Setup

Running tests on real devices is considerably more complicated due to code signing and additional workarounds to Apple limitations. Therefore, the basic process for a successful automation strategy using this driver are as follows –

  • Firstly, Build your app with a Debug configuration, for the specific type of real device you will run the test on, ensuring that the app is also signed for running on your specific device.
  • Secondly, Install the built app to your test device yourself, ensuring it exists on the device and there are no signing issues.
  • Thirdly, Use the bundle ID of your application as the value of the app capability.
  • Next, use the UDID of your device as the udid capability.
  • Lastly, ensure that UI Automation is enabled in the Developer settings.

Real Device Hybrid / Web Testing

Further, hybrid and web testing, Appium requires the use of the Remote Debugging Protocol to send JavaScript to execute inside a web view. Therefore, for real iOS devices, this protocol is encrypted and access must be facilitated using a 3rd-party tool, provided by Google, called ios-webkit-debug-proxy (IWDP).

Tests that run in the Safari browser, we have another hurdle to jump. On real devices, apps that are not signed by the developer cannot be instrumented with UIAutomation. Safari is one such app. Thus we have a helper app called SafariLauncher, which can be signed by the developer. Its sole purpose upon launching is to turn around and launch Safari, which can then be automated via the Remote Debugger in conjunction with IWDP.

 

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

Share this post
[social_warfare]
XCUITest Mobile Gestures
Instruction for SafariLauncher Setup

Get industry recognized certification – Contact us

keyboard_arrow_up