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

Method set_window_size

py/selenium/webdriver/remote/webdriver.py:1117–1129  ·  view source on GitHub ↗

Sets the width and height of the current window. Args: width: The width in pixels to set the window to. height: The height in pixels to set the window to. windowHandle: The handle of the window to resize. Default is "current". Example:

(self, width, height, windowHandle: str = "current")

Source from the content-addressed store, hash-verified

1115 return self.execute(Command.SCREENSHOT)["value"]
1116
1117 def set_window_size(self, width, height, windowHandle: str = "current") -> None:
1118 """Sets the width and height of the current window.
1119
1120 Args:
1121 width: The width in pixels to set the window to.
1122 height: The height in pixels to set the window to.
1123 windowHandle: The handle of the window to resize. Default is "current".
1124
1125 Example:
1126 `driver.set_window_size(800, 600)`
1127 """
1128 self._check_if_window_handle_is_current(windowHandle)
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.

Calls 2

set_window_rectMethod · 0.95