Skip to content

Commit 4d1dcc7

Browse files
modified file as per suggestions by Navin
1 parent ecc8cec commit 4d1dcc7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class ClientWindowState:
2727
MINIMIZED = "minimized"
2828
NORMAL = "normal"
2929

30+
VALID_STATES = {FULLSCREEN, MAXIMIZED, MINIMIZED, NORMAL}
31+
3032

3133
class ClientWindowInfo:
3234
"""Represents a client window information."""
@@ -129,7 +131,7 @@ def from_dict(cls, data: dict) -> "ClientWindowInfo":
129131
ValueError: If required fields are missing or have invalid types.
130132
"""
131133
try:
132-
client_window = data.get("clientWindow")
134+
client_window = data("clientWindow")
133135
if not isinstance(client_window, str):
134136
raise ValueError("clientWindow must be a string")
135137

@@ -139,15 +141,15 @@ def from_dict(cls, data: dict) -> "ClientWindowInfo":
139141
if state not in ClientWindowState.VALID_STATES:
140142
raise ValueError(f"Invalid state: {state}. Must be one of {ClientWindowState.VALID_STATES}")
141143

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

146148
height = data["height"]
147149
if not isinstance(height, int) or height < 0:
148150
raise ValueError(f"height must be a non-negative integer, got {height}")
149151

150-
x = data["x"]
152+
x = data["x"]
151153
if not isinstance(x, int):
152154
raise ValueError(f"x must be an integer, got {type(x).__name__}")
153155

0 commit comments

Comments
 (0)