Skip to content

Commit 0ef0803

Browse files
added deprecations
1 parent 9799cbe commit 0ef0803

File tree

1 file changed

+70
-6
lines changed

1 file changed

+70
-6
lines changed

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

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
18+
import warnings
1919
from typing import Optional
2020

2121
from selenium.webdriver.common.bidi.common import command_builder
@@ -54,6 +54,16 @@ def __init__(
5454
self.y = y
5555
self.active = active
5656

57+
def get_state(self) -> str:
58+
"""Gets the state of the client window.
59+
60+
Returns:
61+
-------
62+
str: The state of the client window (one of the ClientWindowState constants).
63+
"""
64+
warnings.warn("get_state method is deprecated, use `state` property instead", DeprecationWarning, stacklevel=2)
65+
return self.state
66+
5767
@property
5868
def state(self) -> str:
5969
"""Gets the state of the client window.
@@ -76,6 +86,20 @@ def state(self, value) -> None:
7686
raise ValueError(f"Invalid state: {value}. Must be one of {ClientWindowState.VALID_STATES}")
7787
self._state = value
7888

89+
def get_client_window(self) -> str:
90+
"""Gets the client window identifier.
91+
92+
Returns:
93+
-------
94+
str: The client window identifier.
95+
"""
96+
warnings.warn(
97+
"get_client_window method is deprecated, use `client_window` property instead",
98+
DeprecationWarning,
99+
stacklevel=2,
100+
)
101+
return self.client_window
102+
79103
@property
80104
def client_window(self) -> str:
81105
"""Gets the client window identifier.
@@ -96,6 +120,16 @@ def client_window(self, value) -> None:
96120
raise ValueError("clientWindow must be a string")
97121
self._client_window = value
98122

123+
def get_width(self) -> int:
124+
"""Gets the width of the client window.
125+
126+
Returns:
127+
-------
128+
int: The width of the client window.
129+
"""
130+
warnings.warn("get_width method is deprecated, use `width` property instead", DeprecationWarning, stacklevel=2)
131+
return self.width
132+
99133
@property
100134
def width(self) -> int:
101135
"""Gets the width of the client window.
@@ -116,6 +150,18 @@ def width(self, value) -> None:
116150
raise ValueError(f"width must be a non-negative integer, got {value}")
117151
self._width = value
118152

153+
def get_height(self) -> int:
154+
"""Gets the height of the client window.
155+
156+
Returns:
157+
-------
158+
int: The height of the client window.
159+
"""
160+
warnings.warn(
161+
"get_height method is deprecated, use `height` property instead", DeprecationWarning, stacklevel=2
162+
)
163+
return self.height
164+
119165
@property
120166
def height(self) -> int:
121167
"""Gets the height of the client window.
@@ -136,6 +182,16 @@ def height(self, value) -> None:
136182
raise ValueError(f"height must be a non-negative integer, got {value}")
137183
self._height = value
138184

185+
def get_x(self) -> int:
186+
"""Gets the x coordinate of the client window.
187+
188+
Returns:
189+
-------
190+
int: The x coordinate of the client window.
191+
"""
192+
warnings.warn("get_x method is deprecated, use `x` property instead", DeprecationWarning, stacklevel=2)
193+
return self.x
194+
139195
@property
140196
def x(self) -> int:
141197
"""Gets the x coordinate of the client window.
@@ -156,6 +212,16 @@ def x(self, value) -> None:
156212
raise ValueError(f"x must be an integer, got {type(value).__name__}")
157213
self._x = value
158214

215+
def get_y(self) -> int:
216+
"""Gets the y coordinate of the client window.
217+
218+
Returns:
219+
-------
220+
int: The y coordinate of the client window.
221+
"""
222+
warnings.warn("get_y method is deprecated, use `y` property instead", DeprecationWarning, stacklevel=2)
223+
return self.y
224+
159225
@property
160226
def y(self) -> int:
161227
"""Gets the y coordinate of the client window.
@@ -178,7 +244,7 @@ def y(self, value) -> None:
178244

179245
@property
180246
def active(self):
181-
"""Gets the Window Status
247+
"""Gets the Window Status.
182248
183249
Returns:
184250
-------
@@ -188,7 +254,7 @@ def active(self):
188254

189255
@active.setter
190256
def active(self, value) -> None:
191-
"""Sets the Window Status
257+
"""Sets the Window Status.
192258
193259
Returns: None
194260
"""
@@ -229,9 +295,7 @@ def from_dict(cls, data: dict) -> "ClientWindowInfo":
229295

230296

231297
class Browser:
232-
"""
233-
BiDi implementation of the browser module.
234-
"""
298+
"""BiDi implementation of the browser module."""
235299

236300
def __init__(self, conn):
237301
self.conn = conn

0 commit comments

Comments
 (0)