Get a list of the available contexts. Used when testing hybrid mobile apps using Appium.

More info here: https://appium.io/docs/en/commands/context/get-contexts/

Usage

                    .appium.getContexts([callback])
                

Example

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

Parameters

Name Type description
callback
Optional
function

Callback function which is called with the result value.

Returns

Type description
Array<string>

An array of strings representing available contexts, e.g 'WEBVIEW_', or 'NATIVE_APP'

See also