newWindow

Open new window in browser. This command is the equivalent function to window.open(). This command does not work in mobile environments.

Note: When calling this command you automatically switch to the new window.

Usage

1
browser.newWindow(url,windowName,windowFeatures);

Parameters

Param Type Details
url String website URL to open
windowName String name of the new window
windowFeatures String features of opened window (e.g. size, position, scrollbars, etc.)

Example

newWindowSync.js
1
2
3
4
5
6
7
8
9
10
it('should open a new tab', function () {
browser.url('http://google.com')
console.log(browser.getTitle()); // outputs: "Google"

browser.newWindow('http://webdriver.io', 'WebdriverIO window', 'width=420,height=230,resizable,scrollbars=yes,status=1')
console.log(browser.getTitle()); // outputs: "WebdriverIO - WebDriver bindings for Node.js"

browser.close()
console.log(browser.getTitle()); // outputs: "Google"
});

Uses