New Window - WebDriver 编辑
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
BCD tables only load in the browser
See also
- Close Window command
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论