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.
| Method | URI template |
|---|---|
POST | /session/{session id}/window/new |
session idIdentifier of the session.
The input is an object:
typeRequested type of top-level browsing context.
The response payload is an object:
The handle of the new WebWindow.
The created type of top-level browsing context.
invalid session idSession does not exist.
no such windowIf the window has been closed.
unexpected alert openA user prompt, such as window.alert, blocks execution of command until it is dealt with.
unsupported operationThe 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).