This article mainly focuses on how to use Desired Capabilities to set the Geographical Location for running tests in Mobile Web.
Note: To Enable Localization Testing please contact Testsigma Support.
Desired Capabilities for setting location
In order to set the geolocation in a mobile Web test, we can use the below-desired capability:
browserstack.geoLocation = "Two letter Country Code"
For Example:
browserstack.geoLocation = "AR"
Below given are the list of countries with their country codes that can be used in the value field for Desired Capability:
Country Name | Country Code | |
Argentina | AR | |
Australia | AU | |
Austria | AT | |
Belgium | BE | |
Brazil | BR | |
Bulgaria | BG | |
Canada | CA | |
Chile | CL | |
China | CN | |
Croatia | HR | |
Czech Republic | CZ | |
Denmark | DK | |
Egypt | EG | |
Finland | FI | |
France | FR | |
Germany | DE | |
Greece | GR | |
Hong Kong | HK | |
Hungary | HU | |
Iceland | IS | |
India | IN | |
Indonesia | ID | |
Ireland | IE | |
Israel | IL | |
Italy | IT | |
Japan | JP | |
Jordan | JO | |
Malaysia | MY | |
Mexico | MX | |
Netherlands | NL | |
New Zealand | NZ | |
Norway | NO | |
Philippines | PH | |
Poland | PL | |
Portugal | PT | |
Russia | RU | |
Singapore | SG | |
South Africa | ZA | |
South Korea | KR | |
Spain | ES | |
Sweden | SE | |
Switzerland | CH | |
Taiwan | TW | |
Thailand | TH | |
Turkey | TR | |
Ukraine | UA | |
United Kingdom | GB | |
United States | US |
Using Desired Capability to set the Location
We can add the Desired capabilities while creating a run as shown below:
After clicking on desired capabilities we can enter browserstack.geoLocation in the name field, set the value as per the required country's country code, and change the data type to string as shown in the below screenshot:
That's all. Now you can click on Create and Run to start the execution. The execution will start on the cloud device and the location will be detected as the specified one, in this case, Argentina,
Sample Use Case
In this sample use case, we shall use www.google.com for a particular country name i.e Italy and its country code is IT.
In this particular test case, we have used the following test steps and our intention is to see the Google home page that is shown in Italy.
After creating the test cases, click on the Run Test case and set the desired capabilities as per the above syntax.
The below screenshot is for the reference :
After the test case runs you can see the screenshot(if enabled) in the run result to ensure that the URL is shown is specific to Italy.
This is how you can use desire capability specific to browserstack to geolocate any specific county, in the above case Italy.
Welcome to the era of #SmartTestAutomation!