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

Method set_window_rect

py/selenium/webdriver/remote/webdriver.py:1189–1204  ·  view source on GitHub ↗

Set the window's position and size. Sets the x, y coordinates and height and width of the current window. This method is only supported for W3C compatible browsers; other browsers should use `set_window_position` and `set_window_size`. Example: `driver.s

(self, x=None, y=None, width=None, height=None)

Source from the content-addressed store, hash-verified

1187 return self.execute(Command.GET_WINDOW_RECT)["value"]
1188
1189 def set_window_rect(self, x=None, y=None, width=None, height=None) -> dict:
1190 """Set the window's position and size.
1191
1192 Sets the x, y coordinates and height and width of the current window.
1193 This method is only supported for W3C compatible browsers; other browsers
1194 should use `set_window_position` and `set_window_size`.
1195
1196 Example:
1197 `driver.set_window_rect(x=10, y=10)`
1198 `driver.set_window_rect(width=100, height=200)`
1199 `driver.set_window_rect(x=10, y=10, width=100, height=200)`
1200 """
1201 if (x is None and y is None) and (not height and not width):
1202 raise InvalidArgumentException("x and y or height and width need values")
1203
1204 return self.execute(Command.SET_WINDOW_RECT, {"x": x, "y": y, "width": width, "height": height})["value"]
1205
1206 @property
1207 def file_detector(self) -> FileDetector:

Calls 2

executeMethod · 0.95