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

Method set_window_size

py/selenium/webdriver/remote/webdriver.py:1010–1022  ·  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

1008 return self.execute(Command.SCREENSHOT)["value"]
1009
1010 def set_window_size(self, width, height, windowHandle: str = "current") -> None:
1011 """Sets the width and height of the current window.
1012
1013 Args:
1014 width: The width in pixels to set the window to.
1015 height: The height in pixels to set the window to.
1016 windowHandle: The handle of the window to resize. Default is "current".
1017
1018 Example:
1019 `driver.set_window_size(800, 600)`
1020 """
1021 self._check_if_window_handle_is_current(windowHandle)
1022 self.set_window_rect(width=int(width), height=int(height))
1023
1024 def get_window_size(self, windowHandle: str = "current") -> dict:
1025 """Gets the width and height of the current window.

Calls 2

set_window_rectMethod · 0.95