モバイルデバイスの現在の位置情報を取得します。

使用方法

                    .appium.getGeolocation([callback])
                

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);
  }
};

パラメータ

名前 説明
callback
オプション
関数

結果値とともに呼び出されるコールバック関数。

戻り値

説明
オブジェクト

現在の位置情報: {latitude: 数値, longitude: 数値, altitude: 数値}

参考