Set the current geolocation of the mobile device.

Usage

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

Example

module.exports = {
  'set geolocation to Tokyo, Japan': function (app) {
    app
      .appium.setGeolocation({latitude: 35.689487, longitude: 139.691706, altitude: 5});
  },

  'set geolocation to Tokyo, Japan with ES6 async/await': async function (app) {
    await app.appium.setGeolocation({latitude: 35.689487, longitude: 139.691706});
  }
};

Parameters

Name Type description
coordinates
Optional
object

latitude and longitude are required; altitude is optional. All should be of type number.

callback
Optional
function

Optional callback function to be called when the command finishes.

See also