IP Geolocation testing

Restriction: This feature is currently only available upon request and only in non-hybrid enterprise clouds. If you are interested, contact Perfecto Support.

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.

Important: Setting the IP geolocation might impact performance due to additional routing and network conditions at the target 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

perfecto:geoLocation:set

Sets the IP geolocation used for testing

ArgentinaAustralia | Austria | Belgium | Brazil | Bulgaria | Canada | CA-British Columbia | CA-Ontario| CA-Quebec | China | Colombia | Croatia | Cyprus | Czechia | Denmark | Dominican Republic | Estonia | Finland | France |Germany | Greece | Hungary | India | Indonesia | Ireland | Italy | Japan | Latvia | Lithuania | Luxembourg | Mexico | Netherlands | Norway | Peru | Poland | Romania | Portugal | S. Africa | S. Korea | Slovakia | Slovenia | Spain | Sweden | Switzerland | Turkey |UK | US-California | US-Colorado | US-East | US-Utah | US-Virginia| US-West

perfecto:geoLocation:get

Gets the IP geolocation currently set

 

perfecto:geoLocation:reset

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:

Copy
capabilities.setCapability("geoLocation", "France");

Examples (Java)

Copy
Set geolocation
param.put("location", "Canada");
driver.executeScript("perfecto:geoLocation:set", param);
Copy
Get geolocation
String location = driver.executeScript("perfecto:geoLocation:get");
Copy
Reset geolocation
driver.executeScript("perfecto:geoLocation:reset");

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.