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
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).
Example
Specifications
Specification |
---|
WebDriver # new-window |
Browser compatibility
BCD tables only load in the browser
See also
- Close Window command