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
browser.newWindow(url, windowName, windowFeatures)
Parameters
Param | Type | Details |
---|---|---|
url optional | param | website URL to open |
windowName optional | param | name of the new window |
windowFeatures optional | param | features of opened window (e.g. size, position, scrollbars, etc.) |
Example
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"
});