New Window

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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 (e.g., when it is not possible to create a new tab or window).

Specifications

Specification
WebDriver
# new-window

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
NewWindow
Chrome – No support
Chrome
footnote
footnote To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
Edge – No support
Edge
footnote
footnote To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
Firefox – Full support
Firefox 66 (Release date: 2019-03-19)
footnote Full support
Opera – No support
Opera
footnote
footnote To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
Safari – No support
Safari
footnote
footnote The vendor-supported implementation for Safari is non spec-conforming and incompatible.
Chrome Android – No support
Chrome Android
footnote
footnote To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
Firefox for Android – Full support
Firefox for Android 66 (Release date: 2019-03-19)
footnote Full support
Opera Android – No support
Opera Android
footnote
footnote To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
Safari on iOS – No support
Safari on iOS
footnote
footnote The vendor-supported implementation for Safari on iOS is non spec-conforming and incompatible.
Samsung Internet – No support
Samsung Internet
footnote
footnote The vendor-supported implementation for Samsung Internet is non-spec-conforming and incompatible.
WebView Android – No support
WebView Android
footnote
footnote To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabilities.
WebView on iOS – No support
WebView on iOS
footnote
footnote The vendor-supported implementation for WebView on iOS is non spec-conforming and incompatible.

Legend

Tip: you can click/tap on a cell for more information.

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

See also