IP Geolocation testing
This feature is not supported with virtual devices, Perfecto Connect, HAR file generation, network virtualization, and VPN connection.
Geolocation refers to a device's physical location. Geolocation testing is essential to ensuring that your app performs as intended for users wherever they are. There might even be scenarios where an application's functionality depends completely on geo-location. Your app may provide different services or content based on a user's location in the world.
Perfecto lets you simulate the physical location of the device running your app to a number of countries. Selecting an IP geolocation allows you to access the internet at the selected location. Your application's backend will see the session with an IP address from the selected location.
To perform IP geolocation testing, you can use the Perfecto commands listed in the following table in your web or mobile automation scripts.
For information on using an IP geolocation during manual testing, see Set an IP geolocation.
Command |
Description |
Possible values |
---|---|---|
Sets the IP geolocation used for testing |
|
|
Gets the IP geolocation currently set |
||
Resets the IP geolocation to the device's physical location |
Alternatively, you can set the location as part of the device capabilities using the geoLocation
capability, as follows:
capabilities.setCapability("geoLocation", "France");
Examples (Java)
param.put("location", "Canada");
driver.executeScript("perfecto:geoLocation:set", param);
Error messages
The following table lists the error numbers and messages that may occur.
Error number* |
Error message |
Description |
---|---|---|
170 |
Failed to set Geolocation. Cannot find proxy for location <location-name>. |
Returned for an IP geolocation that does not exist |
171 |
Failed to set Geolocation. |
Returned if there was a problem setting the IP geolocation |
172 |
Failed to reset Geolocation. |
Returned if the geolocation could not be reset |
173 |
Perfecto Connect & Geolocation are not supported concurrently. |
Returned if you try to work with IP geolocations while connected to Perfecto Connect |
* Only relevant for web testing.