MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / get_window_size

Method get_window_size

py/selenium/webdriver/remote/webdriver.py:1131–1143  ·  view source on GitHub ↗

Gets the width and height of the current window. Example: `driver.get_window_size()`

(self, windowHandle: str = "current")

Source from the content-addressed store, hash-verified

1129 self.set_window_rect(width=int(width), height=int(height))
1130
1131 def get_window_size(self, windowHandle: str = "current") -> dict:
1132 """Gets the width and height of the current window.
1133
1134 Example:
1135 `driver.get_window_size()`
1136 """
1137 self._check_if_window_handle_is_current(windowHandle)
1138 size = self.get_window_rect()
1139
1140 if size.get("value", None):
1141 size = size["value"]
1142
1143 return {k: size[k] for k in ("width", "height")}
1144
1145 def set_window_position(self, x: float, y: float, windowHandle: str = "current") -> dict:
1146 """Sets the x,y position of the current window.

Calls 3

get_window_rectMethod · 0.95
getMethod · 0.65