Mock the geolocation of the browser. Call without any arguments to reset the geolocation back to original.

Usage

.setGeolocation({latitude, longitude, accuracy}, [callback])

Example

Or run locally with:
git clone https://github.com/nightwatchjs/nightwatch-examples.git
cd nightwatch-examples
npm install
npx nightwatch tests/api/setGeolocation.js

Parameters

Name Type description
coordinates
Optional
object

Latitude, longitude, and accuracy.

callback
Optional
function

Callback function to be called when the command finishes.

Recommended content