Skip to content

Commit 4ba3d99

Browse files
committed
refactor: update argument documentation format in ActionChains class
1 parent 5609fbc commit 4ba3d99

File tree

1 file changed

+60
-60
lines changed

1 file changed

+60
-60
lines changed

py/selenium/webdriver/common/action_chains.py

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ class ActionChains:
6969
def __init__(self, driver: WebDriver, duration: int = 250, devices: list[AnyDevice] | None = None) -> None:
7070
"""Creates a new ActionChains.
7171
72-
:Args:
73-
- driver: The WebDriver instance which performs user actions.
74-
- duration: override the default 250 msecs of DEFAULT_MOVE_DURATION in PointerInput
72+
Args:
73+
driver: The WebDriver instance which performs user actions.
74+
duration: override the default 250 msecs of DEFAULT_MOVE_DURATION in PointerInput
7575
"""
7676
self._driver = driver
7777
mouse = None
@@ -101,9 +101,9 @@ def reset_actions(self) -> None:
101101
def click(self, on_element: WebElement | None = None) -> ActionChains:
102102
"""Clicks an element.
103103
104-
:Args:
105-
- on_element: The element to click.
106-
If None, clicks on current mouse position.
104+
Args:
105+
on_element: The element to click.
106+
If None, clicks on current mouse position.
107107
"""
108108
if on_element:
109109
self.move_to_element(on_element)
@@ -117,9 +117,9 @@ def click(self, on_element: WebElement | None = None) -> ActionChains:
117117
def click_and_hold(self, on_element: WebElement | None = None) -> ActionChains:
118118
"""Holds down the left mouse button on an element.
119119
120-
:Args:
121-
- on_element: The element to mouse down.
122-
If None, clicks on current mouse position.
120+
Args:
121+
on_element: The element to mouse down.
122+
If None, clicks on current mouse position.
123123
"""
124124
if on_element:
125125
self.move_to_element(on_element)
@@ -132,9 +132,9 @@ def click_and_hold(self, on_element: WebElement | None = None) -> ActionChains:
132132
def context_click(self, on_element: WebElement | None = None) -> ActionChains:
133133
"""Performs a context-click (right click) on an element.
134134
135-
:Args:
136-
- on_element: The element to context-click.
137-
If None, clicks on current mouse position.
135+
Args:
136+
on_element: The element to context-click.
137+
If None, clicks on current mouse position.
138138
"""
139139
if on_element:
140140
self.move_to_element(on_element)
@@ -148,9 +148,9 @@ def context_click(self, on_element: WebElement | None = None) -> ActionChains:
148148
def double_click(self, on_element: WebElement | None = None) -> ActionChains:
149149
"""Double-clicks an element.
150150
151-
:Args:
152-
- on_element: The element to double-click.
153-
If None, clicks on current mouse position.
151+
Args:
152+
on_element: The element to double-click.
153+
If None, clicks on current mouse position.
154154
"""
155155
if on_element:
156156
self.move_to_element(on_element)
@@ -165,9 +165,9 @@ def drag_and_drop(self, source: WebElement, target: WebElement) -> ActionChains:
165165
"""Holds down the left mouse button on the source element, then moves
166166
to the target element and releases the mouse button.
167167
168-
:Args:
169-
- source: The element to mouse down.
170-
- target: The element to mouse up.
168+
Args:
169+
source: The element to mouse down.
170+
target: The element to mouse up.
171171
"""
172172
self.click_and_hold(source)
173173
self.release(target)
@@ -177,10 +177,10 @@ def drag_and_drop_by_offset(self, source: WebElement, xoffset: int, yoffset: int
177177
"""Holds down the left mouse button on the source element, then moves
178178
to the target offset and releases the mouse button.
179179
180-
:Args:
181-
- source: The element to mouse down.
182-
- xoffset: X offset to move to.
183-
- yoffset: Y offset to move to.
180+
Args:
181+
source: The element to mouse down.
182+
xoffset: X offset to move to.
183+
yoffset: Y offset to move to.
184184
"""
185185
self.click_and_hold(source)
186186
self.move_by_offset(xoffset, yoffset)
@@ -191,10 +191,10 @@ def key_down(self, value: str, element: WebElement | None = None) -> ActionChain
191191
"""Sends a key press only, without releasing it. Should only be used
192192
with modifier keys (Control, Alt and Shift).
193193
194-
:Args:
195-
- value: The modifier key to send. Values are defined in `Keys` class.
196-
- element: The element to send keys.
197-
If None, sends a key to current focused element.
194+
Args:
195+
value: The modifier key to send. Values are defined in `Keys` class.
196+
element: The element to send keys.
197+
If None, sends a key to current focused element.
198198
199199
Example, pressing ctrl+c::
200200
@@ -211,10 +211,10 @@ def key_down(self, value: str, element: WebElement | None = None) -> ActionChain
211211
def key_up(self, value: str, element: WebElement | None = None) -> ActionChains:
212212
"""Releases a modifier key.
213213
214-
:Args:
215-
- value: The modifier key to send. Values are defined in Keys class.
216-
- element: The element to send keys.
217-
If None, sends a key to current focused element.
214+
Args:
215+
value: The modifier key to send. Values are defined in Keys class.
216+
element: The element to send keys.
217+
If None, sends a key to current focused element.
218218
219219
Example, pressing ctrl+c::
220220
@@ -231,9 +231,9 @@ def key_up(self, value: str, element: WebElement | None = None) -> ActionChains:
231231
def move_by_offset(self, xoffset: int, yoffset: int) -> ActionChains:
232232
"""Moving the mouse to an offset from current mouse position.
233233
234-
:Args:
235-
- xoffset: X offset to move to, as a positive or negative integer.
236-
- yoffset: Y offset to move to, as a positive or negative integer.
234+
Args:
235+
xoffset: X offset to move to, as a positive or negative integer.
236+
yoffset: Y offset to move to, as a positive or negative integer.
237237
"""
238238

239239
self.w3c_actions.pointer_action.move_by(xoffset, yoffset)
@@ -244,8 +244,8 @@ def move_by_offset(self, xoffset: int, yoffset: int) -> ActionChains:
244244
def move_to_element(self, to_element: WebElement) -> ActionChains:
245245
"""Moving the mouse to the middle of an element.
246246
247-
:Args:
248-
- to_element: The WebElement to move to.
247+
Args:
248+
to_element: The WebElement to move to.
249249
"""
250250

251251
self.w3c_actions.pointer_action.move_to(to_element)
@@ -257,10 +257,10 @@ def move_to_element_with_offset(self, to_element: WebElement, xoffset: int, yoff
257257
"""Move the mouse by an offset of the specified element. Offsets are
258258
relative to the in-view center point of the element.
259259
260-
:Args:
261-
- to_element: The WebElement to move to.
262-
- xoffset: X offset to move to, as a positive or negative integer.
263-
- yoffset: Y offset to move to, as a positive or negative integer.
260+
Args:
261+
to_element: The WebElement to move to.
262+
xoffset: X offset to move to, as a positive or negative integer.
263+
yoffset: Y offset to move to, as a positive or negative integer.
264264
"""
265265

266266
self.w3c_actions.pointer_action.move_to(to_element, int(xoffset), int(yoffset))
@@ -279,9 +279,9 @@ def pause(self, seconds: float | int) -> ActionChains:
279279
def release(self, on_element: WebElement | None = None) -> ActionChains:
280280
"""Releasing a held mouse button on an element.
281281
282-
:Args:
283-
- on_element: The element to mouse up.
284-
If None, releases on current mouse position.
282+
Args:
283+
on_element: The element to mouse up.
284+
If None, releases on current mouse position.
285285
"""
286286
if on_element:
287287
self.move_to_element(on_element)
@@ -294,9 +294,9 @@ def release(self, on_element: WebElement | None = None) -> ActionChains:
294294
def send_keys(self, *keys_to_send: str) -> ActionChains:
295295
"""Sends keys to current focused element.
296296
297-
:Args:
298-
- keys_to_send: The keys to send. Modifier keys constants can be found in the
299-
'Keys' class.
297+
Args:
298+
keys_to_send: The keys to send. Modifier keys constants can be found in the
299+
'Keys' class.
300300
"""
301301
typing = keys_to_typing(keys_to_send)
302302

@@ -309,10 +309,10 @@ def send_keys(self, *keys_to_send: str) -> ActionChains:
309309
def send_keys_to_element(self, element: WebElement, *keys_to_send: str) -> ActionChains:
310310
"""Sends keys to an element.
311311
312-
:Args:
313-
- element: The element to send keys.
314-
- keys_to_send: The keys to send. Modifier keys constants can be found in the
315-
'Keys' class.
312+
Args:
313+
element: The element to send keys.
314+
keys_to_send: The keys to send. Modifier keys constants can be found in the
315+
'Keys' class.
316316
"""
317317
self.click(element)
318318
self.send_keys(*keys_to_send)
@@ -322,8 +322,8 @@ def scroll_to_element(self, element: WebElement) -> ActionChains:
322322
"""If the element is outside the viewport, scrolls the bottom of the
323323
element to the bottom of the viewport.
324324
325-
:Args:
326-
- element: Which element to scroll into the viewport.
325+
Args:
326+
element: Which element to scroll into the viewport.
327327
"""
328328

329329
self.w3c_actions.wheel_action.scroll(origin=element)
@@ -333,9 +333,9 @@ def scroll_by_amount(self, delta_x: int, delta_y: int) -> ActionChains:
333333
"""Scrolls by provided amounts with the origin in the top left corner
334334
of the viewport.
335335
336-
:Args:
337-
- delta_x: Distance along X axis to scroll using the wheel. A negative value scrolls left.
338-
- delta_y: Distance along Y axis to scroll using the wheel. A negative value scrolls up.
336+
Args:
337+
delta_x: Distance along X axis to scroll using the wheel. A negative value scrolls left.
338+
delta_y: Distance along Y axis to scroll using the wheel. A negative value scrolls up.
339339
"""
340340

341341
self.w3c_actions.wheel_action.scroll(delta_x=delta_x, delta_y=delta_y)
@@ -348,13 +348,13 @@ def scroll_from_origin(self, scroll_origin: ScrollOrigin, delta_x: int, delta_y:
348348
is not in the viewport, the bottom of the element will first be
349349
scrolled to the bottom of the viewport.
350350
351-
:Args:
352-
- origin: Where scroll originates (viewport or element center) plus provided offsets.
353-
- delta_x: Distance along X axis to scroll using the wheel. A negative value scrolls left.
354-
- delta_y: Distance along Y axis to scroll using the wheel. A negative value scrolls up.
351+
Args:
352+
scroll_origin: Where scroll originates (viewport or element center) plus provided offsets.
353+
delta_x: Distance along X axis to scroll using the wheel. A negative value scrolls left.
354+
delta_y: Distance along Y axis to scroll using the wheel. A negative value scrolls up.
355355
356-
:Raises: If the origin with offset is outside the viewport.
357-
- MoveTargetOutOfBoundsException - If the origin with offset is outside the viewport.
356+
Raises:
357+
MoveTargetOutOfBoundsException: If the origin with offset is outside the viewport.
358358
"""
359359

360360
if not isinstance(scroll_origin, ScrollOrigin):

0 commit comments

Comments
 (0)