Get the current context in which Appium is running. Used when testing hybrid mobile apps using Appium.

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

Usage

                    .appium.getContext([callback])
                

Example

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

Parameters

Name Type description
callback
Optional
function

Callback function which is called with the result value.

Returns

Type description
string | null

A string representing the current context, or null representing "no context".

See also