利用可能なコンテキストのリストを取得します。Appiumを使用したハイブリッドモバイルアプリのテストに使用します。

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

使い方

                    .appium.getContexts([callback])
                

module.exports = {
  'get available contexts': function (app) {
    app
      .appium.getContexts(function (result) {
        console.log('the available contexts are:', result.value);
      });
  },

  'get available contexts with ES6 async/await': async function (app) {
    const contexts = await app.appium.getContexts();
    console.log('the available contexts are:', contexts);
  }
};

パラメータ

名前 タイプ 説明
callback
オプション
function

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

戻り値

タイプ 説明
Array<string>

利用可能なコンテキストを表す文字列の配列。例:'WEBVIEW_'または'NATIVE_APP'

参照