Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. WebDriver
  3. Reference
  4. Commands
  5. Get Window Rect

Get Window Rect

Limited availability

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

TheGet Window Rectcommand of theWebDriver API returns the size and position of the givenWebElement. ManyWebDriver clients present separate API methods for getting an element's location and dimensions, but as an optimization they both use this primitive.

The command operates on the currently selected window, and returns size and position of the operating system window. The returnedWindowRect can be used as input for theSet 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 aWindowRect:

x

Horizontal position of the operating system window associated withwindow, equivalent toWindow.screenX.

y

Vertical position of the operating system window associated withwindow, equivalent toWindow.screenY.

width

Width of outer bounds of the operating system window associated withwindow, equivalent toWindow.outerWidth.

height

Height of the outer bounds of the operating system window associated withwindow, equivalent toWindow.outerHeight.

Errors

Invalid session ID

Session does not exist.

Unexpected alert open

A user prompt, such aswindow.alert, blocks execution of command until it is dealt with.

Specifications

Specification
WebDriver
# get-window-rect

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp