Retrieve the list of all window handles available to the session.

Usage

                    .window.getAllHandles([callback])
                

Example

module.exports = {
 'get all window handles': function (browser) {
    browser.window.getAllHandles(function (result) {
      console.log('available window handles are:', result.value);
    });
  },

  'get all window handles with ES6 async/await': async function (browser) {
    const windowHandles = await browser.window.getAllHandles();
    console.log('available window handles are:', windowHandles);
  }
}

Parameters

Name Type description
callback function

Callback function which is called with the result value.

Returns

Type description
Array[string]

An array of all available window handles.

See also

W3C WebDriver spec