1. Home
  2. AstroFarm
  3. How to run iOS Automation on AstroFarm Device?

How to run iOS Automation on AstroFarm Device?

KB ID: 42G2205341
Views: 523
Updated: May 2022
  1. Login to your AstroFarm account
  2. Take Remote of an iOS device
  3. Get the Automation URL of the specific iOS device as shown in the image below

4. Add URL in Appium Script Desired Capabilities as Appium Server URL
URL(“<Paste the AstroFarm automation URL here>/wd/hub”)


  1. Make sure your IPA file has developer signatures that include the UDID of the test device.
  2. iOS Automation support is added onwards AstroFarm Console v0.45.25.
  3. If we release/free up the iOS during automation then automation will not work.

Demo Appium iOS automation Code using Java + TestNg

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;

public class BaseTest { public static IOSDriver driverAppium; public static String deviceUDID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; //This value we can get it from xcode >> window >> Devices and Simulators public static String xcodeOrgId="xxxxxxxxxx"; //specify Apple Developer Team ID, you can find it on the Apple Developer Portal -> Account -> Membership -> Team ID public static String automationURL="http://astrofarm.42gears.com:20007/wd/hub"; @BeforeClass public void setUp() throws MalformedURLException { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("platformName","iOS"); capabilities.setCapability("automationName","XCUITest"); capabilities.setCapability("platformVersion","15.3"); capabilities.setCapability("deviceName","iPad mini 4"); capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"safari"); capabilities.setCapability("udid",deviceUDID); capabilities.setCapability("xcodeOrgId", xcodeOrgId); capabilities.setCapability("xcodeSigningId", "iPhone Developer"); capabilities.setCapability("usePrebuiltWDA", "true"); capabilities.setCapability("skipServerInstallation", true); capabilities.setCapability(MobileCapabilityType.FULL_RESET, true); driverAppium = new IOSDriver<>(new URL(automationURL), capabilities); //Here we add the AstroFarm Automation URL driverAppium.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); } @AfterClass public void tearDown(){ try { driverAppium.quit(); } catch(Exception e) { } } @Test(priority = 1, invocationCount =2 ) public void demoCode() throws InterruptedException, IOException { driverAppium.get("https://google.com"); } }

Related Articles