Skip to content

Commit 6a87672

Browse files
Update browser.py
Co-authored-by: Navin Chandra <[email protected]>
1 parent 67f2a9e commit 6a87672

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

py/selenium/webdriver/common/bidi/browser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ def from_dict(cls, data: dict) -> "ClientWindowInfo":
139139
if state not in ClientWindowState.VALID_STATES:
140140
raise ValueError(f"Invalid state: {state}. Must be one of {ClientWindowState.VALID_STATES}")
141141

142-
width = data.get("width")
143-
if not isinstance(width, int):
144-
raise ValueError("width must be an integer")
142+
width = data["width"]
143+
if not isinstance(width, int) or width < 0:
144+
raise ValueError(f"width must be a non-negative integer, got {width}")
145145

146146
height = data.get("height")
147147
if not isinstance(height, int):

0 commit comments

Comments
 (0)