Skip to main content

iOS Location Services

info

Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .

NamePossible Values
<br/><br/>locationServicesAuthorized<br/><br/>true / false



Default: false
warning

In order to get a location from the device, it is necessary to:

  1. Turn on Location Services on the iOS device. Settings → Privacy → Location Services
  2. Make sure Airplane mode is turned off. Settings → Airplane Mode

Example (Java) Expand source

public void test() throws MalformedURLException {
IOSDriver<IOSElement> driver = null;
try {
DesiredCapabilities dc = new DesiredCapabilities();

// authorizing the user to get locations
dc.setCapability("locationServicesAuthorized", true);
driver = new IOSDriver<>(new URL(SERVER_URL), dc);

// setting mock location for iOS device
driver.setLocation(new Location(40.712775, -74.015268, 0));

// getting location of the iOS device
Location location = driver.location();
} finally {
driver.quit();
}
}