Opens a new top-level browser window, which can be either a tab (default) or a separate new window.

This command is only available for W3C Webdriver compatible browsers.

Usage

Parameters

Name Type description
type
Optional
string

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

callback
Optional
function

Optional callback function to be called when the command finishes.

Example

module.exports = {
 'demo Test': function(browser) {
    // open a new window tab (default)
    browser.openNewWindow(function(result) {
      console.log(result);
    });

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

  'ES6 async demo Test': async function(browser) {
    const result = await browser.openNewWindow();
    console.log('result value is:', result.value);
  }
}

W3C WebDriver spec