Appiumが実行されている現在のコンテキストを取得します。Appiumを使用してハイブリッドモバイルアプリをテストする際に使用します。

詳細はこちら: https://appium.dokyumento.jp/docs/en/commands/context/get-context/

使用方法

                    .appium.getContext([callback])
                

module.exports = {
  'get current context': function (app) {
    app
      .appium.getContext(function (result) {
        console.log('the current context is:', result.value);
      });
  },

  'get current context with ES6 async/await': async function (app) {
    const context = await app.appium.getContext();
    console.log('the current context is:', context);
  }
};

パラメータ

名前 説明
callback
任意
function

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

戻り値

説明
string | null

現在のコンテキストを表す文字列。または「コンテキストなし」を表すnull

参照