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)
| 1080 | return self.execute(Command.GET_WINDOW_RECT)["value"] |
| 1081 | |
| 1082 | def set_window_rect(self, x=None, y=None, width=None, height=None) -> dict: |
| 1083 | """Set the window's position and size. |
| 1084 | |
| 1085 | Sets the x, y coordinates and height and width of the current window. |
| 1086 | This method is only supported for W3C compatible browsers; other browsers |
| 1087 | should use `set_window_position` and `set_window_size`. |
| 1088 | |
| 1089 | Example: |
| 1090 | `driver.set_window_rect(x=10, y=10)` |
| 1091 | `driver.set_window_rect(width=100, height=200)` |
| 1092 | `driver.set_window_rect(x=10, y=10, width=100, height=200)` |
| 1093 | """ |
| 1094 | if (x is None and y is None) and (not height and not width): |
| 1095 | raise InvalidArgumentException("x and y or height and width need values") |
| 1096 | |
| 1097 | return self.execute(Command.SET_WINDOW_RECT, {"x": x, "y": y, "width": width, "height": height})["value"] |
| 1098 | |
| 1099 | @property |
| 1100 | def file_detector(self) -> FileDetector: |