Opens a new tab (default) or a separate new window, and changes focus to the newly opened tab/window.

This command is only available for W3C Webdriver compatible browsers.

Usage

                    .window.open([callback])
                
                    .window.open(type, [callback])
                

Example

module.exports = {
 'open a new tab/window': function (browser) {
    // open a new tab (default)
    browser.window.open(function () {
      console.log('new tab opened successfully');
    });

    // open a new window
    browser.window.open('window', function () {
      console.log('new window opened successfully');
    });
  },

  'open a new tab/window ES6 async demo Test': async function (browser) {
    // open a new tab (default)
    await browser.window.open();

    // open a new window
    await browser.window.open('window');
  }
}

Parameters

Name Type description
type
Optional
string

Can be either "tab" or "window", with "tab" set as default if none is specified.

callback
Optional
function

Optional callback function to be called when the command finishes.

See also

W3C WebDriver spec