.setGeolocation() Suggest edits
Since: 2.2.0Mock the geolocation of the browser.
setGeolocation()
is only available when using Chrome or Edge drivers.
Usage
.setGeolocation({latitude, longitude, accuracy}, [callback])
Parameters
Name | Type | description |
---|---|---|
coordinates |
object | |
callback Optional |
function | Optional callback function to be called when the command finishes. |
Example
this.demoTest = function (browser) {
browser
// Set location of Tokyo, Japan
.setGeolocation({
latitude: 35.689487,
longitude: 139.691706,
accuracy: 100
})
.navigateTo('https://www.gps-coordinates.net/my-location')
.pause(3000);
};