Get device location (FR)
Perfecto Command
mobile:location:get
Supported OS: Android
Purpose
Retrieves the current location of the device. The location coordinates are returned as a Latitude, Longitude pair.
Tip: Use the
driver.location()
method for Appium test scripts.
Parameters
None
Return Value
Object with the Latitude and Longitude values. Casts this as a Location object.
Exceptions
None
Examples
Copy
Java Appium sample
import org.openqa.selenium.html5.Location;
...
Location location1 = driver.location();
Copy
Java sample
Map<String, Object> params = new HashMap<>();
Object result = driver.executeScript("mobile:location:get", params);
Copy
C# sample
Dictionary<String, Object> pars = new Dictionary<String, Object>();
Object result2 = driver.ExecuteScript("mobile:location:get", pars);