App & Browser Testing Made Easy

Give your users a seamless experience by testing on 3000+ real devices and browsers. Don't compromise with emulators and simulators

Home Guide How to run Appium Tests on an iOS device?

How to run Appium Tests on an iOS device?

By Garima Tiwari, Community Contributor -

Table of Contents

The growing market of iOS devices, has made iOS testing greatly significant when it comes to delivering mobile applications that serve, delight, and retain users.

As the market grows at a faster pace, so does the expectations of users. To meet these expectations, companies offer newer versions of these apps with the latest updates every few weeks. This is where automation testing helps development and testing professionals deliver high-end apps within tight deadlines.

Appium is most widely used for mobile app testing. It helps in executing automated tests of native and hybrid applications for Android and iOS devices in order to achieve faster and more accurate results. This article will explore iOS app testing automation using Appium.

What is Appium?

Appium is an open-source automation testing framework for apps supported by platforms like iOS, Android, macOS, and Windows. Similar to Selenium, it enables the tester to write test scripts in different programming languages such as JavaScript, Java, Ruby, Python, PHP, and C#, which can be used for both Android and iOS platforms.

How does Appium iOS work?

Appium works on the principle of RESTful services by sending JSON files, which automatically interact with an iOS application using UI elements like text labels, buttons, etc. via Apple’s UIAutomation API for automated app testing.

The bootstrap.js file works as a TCP server sending test commands to perform actions on the iOS device using Apple’s UIAutomation API framework.

How Appium works for iOS

How Appium works for iOS (Source)

Why use Appium for testing iOS devices?

Appium is an ideal choice for automated testing on iOS devices because of the following features:

  • It is an open-source framework, which means one can save on hefty licensing costs of tools and frameworks.
  • With an in-built XCUITest driver, Appium is capable of producing information logs with a detailed reporting structure. This makes analysis of the test results better and improves debugging efforts.
  • It offers reusability of the same code that is written for iOS devices for Android devices, saving time and effort for the hybrid apps.
  • It allows users to test the application on various versions of iOS devices. This ensures cross platform compatibility for apps.
  • It offers real-time monitoring of the tests on real devices which provides greater reliability.

Prerequisites for Appium testing on iOS devices

Before exploring how to run Appium tests on iOS devices, here are the prerequisites that have to be fulfilled in order to conduct those tests:

bash brew install carthage
brew install carthage
brew install node
brew install maven
  • Install Appium
npm install -g appium
  • A Mac computer with macOS 10.11 or 10.12, and a device with iOS 9.3 or higher
  • Install XCode 11 (XCode 7 or higher is required)
npm install -g ios-deploy

Getting started with running Appium tests on iOS devices

  • Starting the Appium Server
    Launch the Appium server to begin.

When appium server runs for iOS deviceAppium Server runs for iOS device

Getting the iOS device’s details

Get the details of the iOS device used for testing. The details required are device name, iOS version, and bundleId, to set the desired capabilities. Since this example is using XCUITest driver for iOS testing, one has to set the automationName to XCUITest.

Note: XCUITest will only work with iOS 9.3 and above.

Writing the Appium Test Script for iOS Devices

To write the Appium Test Script, create a new project in Eclipse. Create the package and class to start writing the test code.

In this script, (which opens the Google Chrome app on the iPhone under test) the tester needs to set the Desired Capabilities and instantiate the Appium Driver.

Try Appium Testing on Real iOS Devices for Free

(bundleId for Google Chrome app is

import io.appium.java_client.ios.IOSDriver;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;

public class Edition041_iOS_Real_Device {
private IOSDriver driver;

public void setUp() throws MalformedURLException {
//Setting Desired Capabilities
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("platformVersion", "12.4.7");
capabilities.setCapability("deviceName", "iPhone 7");
capabilities.setCapability("udid", "<your iPhone’s udid>");
capabilities.setCapability("bundleId", "");
capabilities.setCapability("xcodeOrgId", "<your org id>");
capabilities.setCapability("xcodeSigningId", "<your signing id>");
capabilities.setCapability("updatedWDABundleId", "");

driver = new IOSDriver<>(new URL("http://localhost:4723/wd/hub"), capabilities);

public void tearDown() {
if (driver != null) {

public void testFindingAnElement() {
driver.findElementByAccessibilityId("Login Screen");

The UDID of the iPhone, iOS version, bundle id details (for the Google Chrome app, in this example), fetched in the previous section has to be used in the code for setting Desired Capabilities and instantiating Appium Driver.

Run this script and the Google Chrome App will be opened on the connected iOS device.

Inspecting UI Elements for iOS

iOS, unlike Android, which provides the UIAutomatorViewer tool, does not have any dedicated tool for identifying iOS Elements. Instead, the tester could use Appium Desktop Inspector for inspecting the UI elements for iOS.

Read More: Appium Desktop Tutorial for Inspecting UI elements

Best Practices for running Appium tests on iOS devices

  • Make sure the installation process is performed carefully and all the dependencies are well managed.
  • Use real devices instead of simulators or emulators to get accurate results. You can use a real device cloud for testing apps. BrowserStack offers real iOS devices so that QAs can perform automated app testing on different versions of real iOS devices.
  • Record functions using Appium and inspect elements using Appium Desktop Inspector for easy and accurate debugging.
  • Find the bundle ID of the application under test diligently, else it might not deliver the desired results.
  • Make sure the app is already installed on the device before running tests.

On a closing note

Appium enables accurate and comprehensive automated testing of hybrid, native, and web applications, thus ridding them of bugs, anomalies, and any issues that may disrupt user experience. Of course, all Appium tests are best run on real mobile devices because monitoring apps in real user conditions generates 100% accurate results, every time.

BrowserStack App Automate offers cloud-based access to both the latest and legacy devices (Android, iOS, and Windows) installed with real operating systems. App Automate also requires no additional setup, helping testers save precious time and meet their deadlines that much faster. Run Appium tests on thousands of real devices so that the app becomes truly cross-platform compatible and user-friendly.

Appium Automation Testing Mobile App Testing

Featured Articles

Getting Started with Espresso – Android UI Automation

Understanding FindElements in Appium

Curated for all your Testing Needs

Actionable Insights, Tips, & Tutorials delivered in your Inbox
By subscribing , you agree to our Privacy Policy.
thank you illustration

Thank you for Subscribing!

Expect a curated list of guides shortly.