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

Example

Or run locally with:
git clone https://github.com/nightwatchjs/nightwatch-examples.git
cd nightwatch-examples
npm install
npx nightwatch tests/api/openNewWindow.js

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.

W3C WebDriver spec