Get Window Rect - WebDriver 编辑

The Get Window Rect command of the WebDriver API returns the size and position of the given WebElement. Many WebDriver clients present separate API methods for getting an element’s location and dimensions, but as an optimisation they both use this primitive.

The command operates on the currently selected window, and returns size and position of the operating system window. The returned WindowRect can be used as input for the Set Window Rect command, which is for manipulating a window’s position and dimensions.

Syntax

MethodURI template
GET/session/{session id}/window/rect

URL parameters

session id
Identifier of the session.

Response

The response payload is a WindowRect:

x
Horizontal position of the operating system window associated with window, equivalent to Window.screenX.
y
Vertical position of the operating system window associated with window, equivalent to Window.screenY.
width
Width of outer bounds of the operating system window associated with window, equivalent to Window.outerWidth.
height
Height of the outer bounds of the operating system window associated with window, equivalent to Window.outerHeight.

Errors

Invalid session ID
Session does not exist.
Unexpected alert open
A user prompt, such as window.alert, blocks execution of command until it is dealt with.

Specifications

SpecificationStatusComment
WebDriver
The definition of 'Get Window Rect' in that specification.
Living StandardInitial definition

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:64 次

字数:4626

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文