New Window

The New Window command of the WebDriver API opens a new top-level browsing context of type window or tab, and returns with a dictionary containing the handle of the new WebWindow and its created type. If the requested type cannot be created by the browser, the alternative type will be tried to create.

Syntax

Method URI template
POST /session/{session id}/window/new

URL parameters

session id
Identifier of the session.

Payload

The input is an object:

type
Requested type of top-level browsing context.

Response

The response payload is an object:

handle
The handle of the new WebWindow.
type
The created type of top-level browsing context.

Errors

Invalid session ID
Session does not exist.
No such window
If the window has been closed.
Unexpected alert open
A user prompt, such as window.alert, blocks execution of command until it is dealt with.
Unsupported Operation
The driver or browser doesn't support the command for some reason, eg. when it is not possible to create a new tab nor window.

Example

Specifications

Specification Status Comment
WebDriver
The definition of 'New_Window' in that specification.
Living Standard Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
NewWindowChrome No support No
Notes
No support No
Notes
Notes To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
Edge No support No
Notes
No support No
Notes
Notes The vendor-supported implementation for Edge is non-spec-conforming and incompatible.
Firefox Full support 66IE Full support 7Opera No support No
Notes
No support No
Notes
Notes To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
Safari No support No
Notes
No support No
Notes
Notes The vendor-supported implementation for Safari is non spec-conforming and incompatible.
WebView Android No support No
Notes
No support No
Notes
Notes To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
Chrome Android No support No
Notes
No support No
Notes
Notes To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
Firefox Android Full support 66Opera Android No support No
Notes
No support No
Notes
Notes To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
Safari iOS No support No
Notes
No support No
Notes
Notes The vendor-supported implementation for Safari is non spec-conforming and incompatible.
Samsung Internet Android No support No
Notes
No support No
Notes
Notes The vendor-supported implementation for Samsung Internet is non-spec-conforming and incompatible.

Legend

Full support Ā 
Full support
No support Ā 
No support
See implementation notes.
See implementation notes.

See also

Ā