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
client.newWindow(url,windowName,windowFeatures).then(callback);

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

newWindow.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
client
.url('http://google.com')
.getTitle().then(function(title) {
console.log(title); // outputs: "Google"
})
.newWindow('http://webdriver.io', 'WebdriverIO window', 'width=420,height=230,resizable,scrollbars=yes,status=1')
.getTitle().then(function(title) {
console.log(title);
// outputs the following:
// "WebdriverIO - Selenium 2.0 javascript bindings for nodejs"
})
.close()
.getTitle().then(function(title) {
console.log(title); // outputs: "Google"
})
.end();

Uses