.getGeolocation() Suggest edits
Get the current geolocation of the mobile device.
Usage
.appium.getGeolocation([callback])
Example
module.exports = {
'get device geolocation': function (app) {
app
.appium.getGeolocation(function (result) {
console.log('current device geolocation is:', result.value);
});
},
'get device geolocation with ES6 async/await': async function (app) {
const location = await app.appium.getGeolocation();
console.log('current device geolocation is:', location);
}
};
Parameters
| Name | Type | description |
|---|---|---|
callbackOptional |
function | Callback function which is called with the result value. |
Returns
| Type | description |
|---|---|
| object | The current geolocation: |