test-suite
2023.4
false
Test Suite User Guide
Automation CloudAutomation Cloud Public SectorAutomation SuiteStandalone
Last updated Aug 13, 2024

Local iOS devices

Setting up local iOS devices

To set up a local device to work with the Mobile Automation activities, you need to run a local instance of Appium, and have the necessary tools to automate iOS devices.

There are two types of local iOS devices that you can automate:

  • Physical - a physical iOS device that you can connect to your local machine, through a USB cable.
  • Emulator - an emulator for an iOS device that's stored locally.

Most used Appium commands

The list below describes the most used commands for setting up Appium in the context of Mobile Device Automation (recommended for Appium 2.0):

  • xcrun simctl list - List available devices, device types, runtimes, or device pairs.
  • xcrun simctl list devices - lists the available devices.
  • xcrun simctl list devicetypes - lists the device types.
  • xcrun simctl list runtimes - lists the runtimes.
  • xcrun simctl list runtimes - lists the device pairs.

Application Storage

You will need to store your mobile apps on the same machine where your Appium server is running, or upload the IPA file to a URL that is anonymously accessible by the Appium server (e.g. Blob storage).

Installing applications from the Play Store or App Store is not possible, except if you manually automate these applications to install your specific application.

Important:
If your app artifact uses the APP extension and you want to upload the app to a public URL, you will need to create a folder named Payload, place the APP inside it, archive the Payload folder and change the extension to IPA instead of ZIP.

Additionally, ensure that the application that you are trying to automate is compiled for the target architecture (simulator or physical device).

Configuring IOS Physical Device

Prerequisites

  1. Install Xcode.
  2. Open a Terminal and run the following command to install Homebrew:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  3. Run the following command to install NodeJS:

    brew install node

  4. Install Appium:
    • For Appium 1.0, run the following command: npm install -g appium. This automatically installed all drivers needed.
    • For Appium 2.0, run the following command: npm install -g appium@next.
Appium 2.0 comes without the drivers installed. Therefore, to install the needed drivers, also run the following command: appium driver install xcuitest.
Important:
  • We recommend using Appium 2.0 with Mobile Automation version 22.10 or higher.
  • Install Appium 2.0 if you want to test your mobile automations on a iOS Physical Device.

    1. Open Xcode and allow it to install any additional components it may require. Close it once you see the splash screen.
    2. Start the Appium server, using the following command: appium --port 8001 --default-capabilities "{\"appium:systemPort\":9001}" --relaxed-security.


Configuring Local Physical IOS Device

  1. Connect your physical device to your Mac.
  2. Unlock your device and, if an alert pops up, make sure to allow the computer to access it.
  3. Get the Appium URL and save it for later:
    • Go to System Settings, then the Network tab, and select the Wi-Fi network that the physical device is connected to.
    • Copy the IP Address for the Wi-Fi network that the device is connected to. The format of the Appium URL is http://<ipaddress>:8001 (8001 is the port number where you start Appium).


  4. Get the UDID of the physical iOS device that you connected to your machine, from XCode.
    • Go to Window > Devices and Simulators > Devices.
    • Click the iOS device that you connected to.
    • Copy the Identifier. This is the UDID, that you'll later add as an additional desired capability, when adding this iOS physical device to MDM.
  5. Build WebDriverAgent with XCode on your Mac.
    • Navigate to the appium-webdriveragent folder, using the following path: /Users/<username>/appium2/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent, and open the xcodeproj file.
    • Select WebDriverAgent, and open WebDriverAgentRunner, under the Targets section.
    • Switch to the Signing & Capabilities tab, select Automatically manage signing, and choose a user account from the Team dropdown.
    • Change the Bundle Identifier to a unique value.
    • Copy and save this Bundle Identifier. You'll use it to add your Application inside MDM (Bundle Id).



  6. Install the WebDriverAgent on your iOS physical device.
    • Select WebDriverAgentRunner in the WebDriverAgent navigation bar.
    • In XCode, go to Product, and click Test. On your connected iOS physical device, you'll see the WebDriverAgent installing.
  7. Add the configurated local physical iOS device in Mobile Device Manager, using the Adding iOS Device in Mobile Device Manager procedure.

Adding Local IOS Device in Mobile Device Manager

  1. Open Mobile Device Manager from Studio.
  2. In the left navigation panel go to Devices.
  3. Configure your device as follows:
    • Name - Enter a name to identify your device in the Devices tab.
    • Appium URL - Enter the Appium URL, that you previously copied, using the following format: http://<ipaddress>:8001.
    • Platform - Click the field to select iOS from the dropdown.
    • Device Name - Enter the device name.
    • Additional Desired Capabilities - Add the following capabilities:

      Name

      Value

      automationName

      xcuitest (This capability activates the Appium iOS driver)

      udid

      the Identifier of the connected physical iOS device

  4. (Optional) Configure logging and video recording details in the Logging tab.
  5. (Optional) Configure your development process in the Development tab.
    • Close Similar Tabs (Activated by default): Close tabs running connections with similar devices and applications.
    • Wait for Page Update (Activated by default): Wait for the page source to retrieve a screenshot of each action.
  6. Click Save & Close to add your device.

    Your device is added to the Devices list. To add a local device, see .

    If you cannot start your device, see Troubleshooting: Physical device fails to start.



Hybrid and Web Automation on IOS

Hybrid automation works by default for iOS devices, provided that you are not attempting to automate an app built for production. When automating production apps, WKWebView hosted content will not be automatable, though any web content hosted in an SFSafariViewController can be automated in production apps as well. For more information, see SFSafariViewController.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.