title | page_title | metadesc | noindex | order | page_id | search_keyword | warning | contextual_links | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Set Geolocation for Tests in Chrome & Firefox |
Set Geolocation for your Tests |
Learn how to set the location of your Test Environment where tests are run by using a pair of desired capabilities in Testsigma Application. |
false |
15.6 |
Set Geolocation for Tests in Chrome and Firefox |
false |
|
For setting the location of the Test Environment where the Tests are run, we just need to add a pair of Desired Capabilities in the Test Environment.
You should already know how to add Desired Capabilities to your Tests. See Desired Capabilities - Overview
##Setting Desired Capabilities in different Browsers
Here are the Desired Capabilities you need to add in Test Environment to set the location for Chrome Browser:
Name | Data Type | Value |
---|---|---|
goog:chromeOptions | String | {"profile.default_content_setting_values.geolocation":1} |
geolocation | String | 51.50735, -0.12776, 100 |
You need to keep the first-row item as it is. In the second row item, the three values correspond to the parameters latitude, longitude and altitude, respectively.
The given value i.e 51.50735, -0.12776, 100 is for 'Trafalgar Square, London'.
Similarly, the value for 'Central Park, NYC, USA' is 40.783840, -73.965550, 33
Here are the Desired Capabilities you need to add in Test Environment to set the location for Firefox Browser:
Name | Data Type | Value |
---|---|---|
firefoxprofile | String | { "geo.prompt.testing": true, "geo.prompt.testing.allow": true, "geo.enabled": true, "geo.wifi.uri": "data:application/json, { \"location\": { \"lat\": 34.052235, \"lng\": -118.243683 }, \"accuracy\": 100.0 }" } |
The value in the location under geo.wifi.uri corresponds to the parameters latitude, longitude, and accuracy.
The given value i.e {"location": {"lat": 34.052235, "lng": -118.243683}, "accuracy": 100.0} is for the location 'Downtown, Los Angeles, California 90012, United States'.
Similarly, the value for the location 'Central Park, NYC, USA' will be {"location": {"lat": 40.783840, "lng": -73.965550}, "accuracy": 100.0}
[[info | NOTE:]] | Setting the Geolocation is not yet supported in IE and Safari
##Example websites to test current location
You can use https://www.mapcoordinates.net/en for the latitude and longitude information for your desired location, and https://mycurrentlocation.net/ to check current location.