aselenium 1.0.0__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aselenium-1.0.0 → aselenium-1.0.2}/MANIFEST.in +1 -0
- {aselenium-1.0.0/src/aselenium.egg-info → aselenium-1.0.2}/PKG-INFO +3 -2
- {aselenium-1.0.0 → aselenium-1.0.2}/setup.cfg +1 -1
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/actions.py +61 -61
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/alert.py +8 -8
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/connection.py +9 -9
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/element.py +99 -98
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/options.py +115 -128
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/service.py +22 -22
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/session.py +346 -346
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/shadow.py +33 -33
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/utils.py +28 -28
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/webdriver.py +22 -22
- {aselenium-1.0.0 → aselenium-1.0.2/src/aselenium.egg-info}/PKG-INFO +3 -2
- {aselenium-1.0.0 → aselenium-1.0.2}/LICENSE +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/README.md +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/pyproject.toml +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/__init__.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/chrome/__init__.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/chrome/options.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/chrome/service.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/chrome/session.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/chrome/webdriver.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/chromium/__init__.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/chromium/options.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/chromium/service.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/chromium/session.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/chromium/webdriver.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/command.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/edge/__init__.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/edge/options.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/edge/service.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/edge/session.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/edge/webdriver.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/errors.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/firefox/__init__.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/firefox/options.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/firefox/service.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/firefox/session.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/firefox/utils.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/firefox/webdriver.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/javascript/__init__.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/javascript/get_attribute.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/javascript/is_viewable.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/logs.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/manager/__init__.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/manager/driver.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/manager/file.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/manager/version.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/safari/__init__.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/safari/options.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/safari/service.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/safari/session.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/safari/webdriver.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/settings.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium/valuewrap.py +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium.egg-info/SOURCES.txt +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium.egg-info/dependency_links.txt +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium.egg-info/requires.txt +0 -0
- {aselenium-1.0.0 → aselenium-1.0.2}/src/aselenium.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: aselenium
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Asyncronous implementation of web browser automation for Python.
|
|
5
5
|
Home-page: https://github.com/AresJef/Aselenium
|
|
6
6
|
Author: Jiefu Chen
|
|
@@ -19,6 +19,7 @@ Requires-Dist: pandas>=2.1.0
|
|
|
19
19
|
Requires-Dist: psutil>=5.8.0
|
|
20
20
|
Requires-Dist: pyarrow>=12.0.1
|
|
21
21
|
Requires-Dist: orjson>=3.9.5
|
|
22
|
+
Dynamic: license-file
|
|
22
23
|
|
|
23
24
|
## Asyncronous implementation of web browser automation for Python.
|
|
24
25
|
|
|
@@ -125,10 +125,10 @@ class Actions:
|
|
|
125
125
|
interactions such as mouse movements, key presses, and
|
|
126
126
|
wheel scrolls.
|
|
127
127
|
|
|
128
|
-
:param session
|
|
129
|
-
:param pointer
|
|
128
|
+
:param session `<'Session'>`: The session to perform the action chain.
|
|
129
|
+
:param pointer `<'str'>`: The pointer type to use. Defaults to `'mouse'`.
|
|
130
130
|
Available options: `"mouse"`, `"pen"`, `"touch"`.
|
|
131
|
-
:param duration
|
|
131
|
+
:param duration `<'int/float'>`: The duration in seconds to perform a pointer move or wheel scroll action. Defaults to `0.2`.
|
|
132
132
|
"""
|
|
133
133
|
# Validate pointer
|
|
134
134
|
if pointer not in Constraint.POINTER_TYPES:
|
|
@@ -163,7 +163,7 @@ class Actions:
|
|
|
163
163
|
# Properties --------------------------------------------------------------------------
|
|
164
164
|
@property
|
|
165
165
|
def actions(self) -> ActionsChain:
|
|
166
|
-
"""Access all the actions to be performed `<ActionsDict>`.
|
|
166
|
+
"""Access all the actions to be performed `<'ActionsDict'>`.
|
|
167
167
|
|
|
168
168
|
Expected format:
|
|
169
169
|
>>> {
|
|
@@ -188,16 +188,16 @@ class Actions:
|
|
|
188
188
|
) -> Actions:
|
|
189
189
|
"""Move the pointer (mouse) to an element (or a location).
|
|
190
190
|
|
|
191
|
-
:param element
|
|
191
|
+
:param element `<'Element/None'>`: The Element to move to. Defaults to `None`.
|
|
192
192
|
- If specified, moves the pointer to the center of the element,
|
|
193
193
|
where 'x/y' are the offsets relative to the center.
|
|
194
194
|
- If not specified (`None`), moves the pointer to the given 'x/y'
|
|
195
195
|
coordinates of the viewport.
|
|
196
196
|
|
|
197
|
-
:param x
|
|
198
|
-
:param y
|
|
199
|
-
:param pause
|
|
200
|
-
:
|
|
197
|
+
:param x `<'int'>`: The x-coordinate of the viewport, `*OR*` the x-offset to the center of an 'element'. Defaults to `0`.
|
|
198
|
+
:param y `<'int'>`: The y-coordinate of the viewport, `*OR*` the y-offset to the center of an 'element'. Defaults to `0`.
|
|
199
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
200
|
+
:returns `<'Actions'>`: The actions chain.
|
|
201
201
|
|
|
202
202
|
### Example:
|
|
203
203
|
>>> # . move the pointer to x/y coordinates of the viewport
|
|
@@ -221,10 +221,10 @@ class Actions:
|
|
|
221
221
|
) -> Actions:
|
|
222
222
|
"""Move the pointer (mouse) by the given offsets.
|
|
223
223
|
|
|
224
|
-
:param x
|
|
225
|
-
:param y
|
|
226
|
-
:param pause
|
|
227
|
-
:
|
|
224
|
+
:param x `<'int'>`: The x-coordinate offset relative to the pointer. Defaults to `0`.
|
|
225
|
+
:param y `<'int'>`: The y-coordinate offset relative to the pointer. Defaults to `0`.
|
|
226
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
227
|
+
:returns `<'Actions'>`: The actions chain.
|
|
228
228
|
|
|
229
229
|
### Example:
|
|
230
230
|
>>> # . move the pointer by x/y offset relative to its origin
|
|
@@ -242,11 +242,11 @@ class Actions:
|
|
|
242
242
|
) -> Actions:
|
|
243
243
|
"""Click a button of the pointer (mouse).
|
|
244
244
|
|
|
245
|
-
:param button
|
|
246
|
-
:param hold
|
|
247
|
-
:param double
|
|
248
|
-
:param pause
|
|
249
|
-
:
|
|
245
|
+
:param button `<'int'>`: The button to click. Defaults to `MouseButtons.LEFT`.
|
|
246
|
+
:param hold `<'bool'>`: Whether to hold the button down after clicked. Defaults to `False`.
|
|
247
|
+
:param double `<'bool'>`: Whether to perform a double click (ignored when `hold=True`). Defaults to `False`.
|
|
248
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
249
|
+
:returns `<'Actions'>`: The actions chain.
|
|
250
250
|
|
|
251
251
|
### Example:
|
|
252
252
|
>>> # . click (press & release) the left button of the pointer
|
|
@@ -276,9 +276,9 @@ class Actions:
|
|
|
276
276
|
"""Release a previously press & hold button of the pointer (mouse).
|
|
277
277
|
Use after the action `click(hold=True)`.
|
|
278
278
|
|
|
279
|
-
:param button
|
|
280
|
-
:param pause
|
|
281
|
-
:
|
|
279
|
+
:param button `<'int'>`: The button to release. Defaults to `MouseButtons.LEFT`.
|
|
280
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
281
|
+
:returns `<'Actions'>`: The actions chain.
|
|
282
282
|
|
|
283
283
|
### Example:
|
|
284
284
|
>>> # . press & hold & release the left button of the pointer
|
|
@@ -304,14 +304,14 @@ class Actions:
|
|
|
304
304
|
) -> Actions:
|
|
305
305
|
"""Drag and drop an element (coordinates) to another element (coordinates).
|
|
306
306
|
|
|
307
|
-
:param drag
|
|
308
|
-
:param drag_x
|
|
309
|
-
:param drag_y
|
|
310
|
-
:param drop
|
|
311
|
-
:param drop_x
|
|
312
|
-
:param drop_y
|
|
313
|
-
:param pause
|
|
314
|
-
:
|
|
307
|
+
:param drag `<'Element/None'>`: The source element to drag. Defaults to `None`.
|
|
308
|
+
:param drag_x `<'int'>`: The x-coordinate of the viewport, `*OR*` the x-offset to the center of a 'drag' element. Defaults to `0`.
|
|
309
|
+
:param drag_y `<'int'>`: The y-coordinate of the viewport, `*OR*` the y-offset to the center of a 'drag' element. Defaults to `0`.
|
|
310
|
+
:param drop `<'Element/None'>`: The destination element to drop. Defaults to `None`.
|
|
311
|
+
:param drop_x `<'int'>`: The x-coordinate of the viewport, `*OR*` the x-offset to the center of an 'drop' element. Defaults to `0`.
|
|
312
|
+
:param drop_y `<'int'>`: The y-coordinate of the viewport, `*OR*` the y-offset to the center of an 'drop' element. Defaults to `0`.
|
|
313
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
314
|
+
:returns `<'Actions'>`: The actions chain.
|
|
315
315
|
|
|
316
316
|
### Notice:
|
|
317
317
|
The `drag_and_drop` method eqvivalent to the following actions:
|
|
@@ -414,9 +414,9 @@ class Actions:
|
|
|
414
414
|
) -> Actions:
|
|
415
415
|
"""Press down a keyboard KEY.
|
|
416
416
|
|
|
417
|
-
:param key
|
|
418
|
-
:param pause
|
|
419
|
-
:
|
|
417
|
+
:param key `<'str/KeyboardKeys'>`: The KEY to press down.
|
|
418
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
419
|
+
:returns `<'Actions'>`: The actions chain.
|
|
420
420
|
|
|
421
421
|
### Example:
|
|
422
422
|
>>> # . control + a (select all)
|
|
@@ -436,9 +436,9 @@ class Actions:
|
|
|
436
436
|
def key_up(self, key: str, pause: int | float | None = None) -> Actions:
|
|
437
437
|
"""Release a keyboard KEY.
|
|
438
438
|
|
|
439
|
-
:param key
|
|
440
|
-
:param pause
|
|
441
|
-
:
|
|
439
|
+
:param key `<'str'>`: The KEY to release.
|
|
440
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
441
|
+
:returns `<'Actions'>`: The actions chain.
|
|
442
442
|
|
|
443
443
|
### Example:
|
|
444
444
|
>>> # . control + a (select all)
|
|
@@ -467,9 +467,9 @@ class Actions:
|
|
|
467
467
|
the actions of typing a series of keyboard keys, such as `Hello world!`.
|
|
468
468
|
Each key is first pressed down and then released in the specified order.
|
|
469
469
|
|
|
470
|
-
:param keys
|
|
471
|
-
:param pause
|
|
472
|
-
:
|
|
470
|
+
:param keys `<'str/KeyboardKeys'>`: The keys to send.
|
|
471
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
472
|
+
:returns `<'Actions'>`: The actions chain.
|
|
473
473
|
|
|
474
474
|
Example:
|
|
475
475
|
>>> From aselenium import KeyboardKeys
|
|
@@ -501,9 +501,9 @@ class Actions:
|
|
|
501
501
|
`ctrl + c` (copy), `ctrl + v` (paste), etc. Each key is first pressed down in
|
|
502
502
|
the specified order, and then released in the reverse order.
|
|
503
503
|
|
|
504
|
-
:param keys
|
|
505
|
-
:param pause
|
|
506
|
-
:
|
|
504
|
+
:param keys `<'str/KeyboardKeys'>`: The keys combinations to send.
|
|
505
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
506
|
+
:returns `<'Actions'>`: The actions chain.
|
|
507
507
|
|
|
508
508
|
### Example:
|
|
509
509
|
>>> From aselenium import KeyboardKeys
|
|
@@ -568,11 +568,11 @@ class Actions:
|
|
|
568
568
|
) -> Actions:
|
|
569
569
|
"""Scroll the viewport to an element.
|
|
570
570
|
|
|
571
|
-
:param element
|
|
572
|
-
:param x
|
|
573
|
-
:param y
|
|
574
|
-
:param pause
|
|
575
|
-
:
|
|
571
|
+
:param element `<'Element/None'>`: The Element to scroll to.
|
|
572
|
+
:param x `<'int'>`: The x-offset to the center of an 'element'. Defaults to `0`.
|
|
573
|
+
:param y `<'int'>`: The y-offset to the center of an 'element'. Defaults to `0`.
|
|
574
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
575
|
+
:returns `<'Actions'>`: The actions chain.
|
|
576
576
|
"""
|
|
577
577
|
if not isinstance(element, Element):
|
|
578
578
|
raise errors.InvalidArgumentError(
|
|
@@ -592,10 +592,10 @@ class Actions:
|
|
|
592
592
|
) -> Actions:
|
|
593
593
|
"""Scroll the viewport by the given offsets.
|
|
594
594
|
|
|
595
|
-
:param x
|
|
596
|
-
:param y
|
|
597
|
-
:param pause
|
|
598
|
-
:
|
|
595
|
+
:param x `<'int'>`: The x-coordinate offset relative to current viewport position. Defaults to `0`.
|
|
596
|
+
:param y `<'int'>`: The y-coordinate offset relative to current viewport position. Defaults to `0`.
|
|
597
|
+
:param pause `<'int/float/None'>`: Total seconds to pause after the action. Defaults to `None`.
|
|
598
|
+
:returns `<'Actions'>`: The actions chain.
|
|
599
599
|
"""
|
|
600
600
|
self._wheel_scroll(x_delta=x, y_delta=y, origin="viewport")
|
|
601
601
|
return self.pause(pause)
|
|
@@ -654,8 +654,8 @@ class Actions:
|
|
|
654
654
|
def pause(self, duration: int | float | None) -> Actions:
|
|
655
655
|
"""Pause the chain for a given duration.
|
|
656
656
|
|
|
657
|
-
:param duration
|
|
658
|
-
:
|
|
657
|
+
:param duration `<'int/float/None'>`: The duration to pause in seconds.
|
|
658
|
+
:returns `<'Actions'>`: The actions chain.
|
|
659
659
|
"""
|
|
660
660
|
if duration is None:
|
|
661
661
|
return self
|
|
@@ -663,7 +663,7 @@ class Actions:
|
|
|
663
663
|
duration = int(duration * 1000)
|
|
664
664
|
except Exception as err:
|
|
665
665
|
raise errors.InvalidArgumentError(
|
|
666
|
-
"<{}>\nArgument 'duration' must be a positive `<int/float>`, "
|
|
666
|
+
"<{}>\nArgument 'duration' must be a positive `<'int/float'>`, "
|
|
667
667
|
"instead of: {}.".format(self.__class__.__name__, repr(duration))
|
|
668
668
|
) from err
|
|
669
669
|
self._add_pointer_pause(duration)
|
|
@@ -675,13 +675,13 @@ class Actions:
|
|
|
675
675
|
async def perform(self, explicit_wait: int | float | None = None) -> None:
|
|
676
676
|
"""Perform (execute) the actions chain.
|
|
677
677
|
|
|
678
|
-
:param explicit_wait
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
678
|
+
:param explicit_wait `<'int/float/None'>`: Total seconds to wait after sending the actions command. Defaults to `None`.
|
|
679
|
+
- For Chromium based browsers, this argument is usually not needed. The webdriver
|
|
680
|
+
itself will wait until all the actions are performed before returning a response.
|
|
681
|
+
- For Firefox, specifing an explicit wait is required in most cases, since the
|
|
682
|
+
webdriver will return a response immediately after receiving the actions command.
|
|
683
|
+
Without an explicit long enough block, the next line of code will be executed
|
|
684
|
+
while the browser is still performing the actions.
|
|
685
685
|
"""
|
|
686
686
|
# Perform the actions
|
|
687
687
|
try:
|
|
@@ -716,7 +716,7 @@ class Actions:
|
|
|
716
716
|
except Exception as err:
|
|
717
717
|
raise errors.InvalidArgumentError(
|
|
718
718
|
"<{}>\nArgument 'explicit_wait' must "
|
|
719
|
-
"be a positive `<int/float>`, instead of: {} {}.".format(
|
|
719
|
+
"be a positive `<'int/float'>`, instead of: {} {}.".format(
|
|
720
720
|
self.__class__.__name__, repr(explicit_wait), type(explicit_wait)
|
|
721
721
|
)
|
|
722
722
|
) from err
|
|
@@ -35,14 +35,14 @@ class Alert:
|
|
|
35
35
|
def __init__(self, session: Session) -> None:
|
|
36
36
|
"""The JavaScript alert.
|
|
37
37
|
|
|
38
|
-
:param session
|
|
38
|
+
:param session `<'Session'>`: The session the alert raises.
|
|
39
39
|
"""
|
|
40
40
|
self._session: Session = session
|
|
41
41
|
|
|
42
42
|
# Properties --------------------------------------------------------------------------
|
|
43
43
|
@property
|
|
44
44
|
async def text(self) -> str | None:
|
|
45
|
-
"""Access the text of the alert `<str>`."""
|
|
45
|
+
"""Access the text of the alert `<'str'>`."""
|
|
46
46
|
try:
|
|
47
47
|
res = await self._session.execute_command(Command.W3C_GET_ALERT_TEXT)
|
|
48
48
|
except errors.InvalidMethodError:
|
|
@@ -59,7 +59,7 @@ class Alert:
|
|
|
59
59
|
async def dismiss(self, pause: int | float | None = None) -> None:
|
|
60
60
|
"""Dismiss the alert.
|
|
61
61
|
|
|
62
|
-
:param pause
|
|
62
|
+
:param pause `<'int/float/None'>`: The pause in seconds after execution. Defaults to `None`.
|
|
63
63
|
This can be useful to wait for the command to take effect,
|
|
64
64
|
before executing the next command. Defaults to `None` - no pause.
|
|
65
65
|
"""
|
|
@@ -69,7 +69,7 @@ class Alert:
|
|
|
69
69
|
async def accept(self, pause: int | float | None = None) -> None:
|
|
70
70
|
"""Accept the alert.
|
|
71
71
|
|
|
72
|
-
:param pause
|
|
72
|
+
:param pause `<'int/float/None'>`: The pause in seconds after execution. Defaults to `None`.
|
|
73
73
|
This can be useful to wait for the command to take effect,
|
|
74
74
|
before executing the next command. Defaults to `None` - no pause.
|
|
75
75
|
"""
|
|
@@ -84,9 +84,9 @@ class Alert:
|
|
|
84
84
|
) -> None:
|
|
85
85
|
"""Simulate typing or keyboard keys pressing into the alert.
|
|
86
86
|
|
|
87
|
-
:param values
|
|
88
|
-
:param sep
|
|
89
|
-
:param pause
|
|
87
|
+
:param values `<'str'>`: The strings to be typed or keyboard keys to be pressed.
|
|
88
|
+
:param sep `<'str'>`: The separator between each values. Defaults to `' '`.
|
|
89
|
+
:param pause `<'int/float/None'>`: The pause in seconds after execution. Defaults to `None`.
|
|
90
90
|
This can be useful to wait for the command to take effect,
|
|
91
91
|
before executing the next command. Defaults to `None` - no pause.
|
|
92
92
|
|
|
@@ -117,7 +117,7 @@ class Alert:
|
|
|
117
117
|
async def pause(self, duration: int | float | None) -> None:
|
|
118
118
|
"""Pause the for a given duration.
|
|
119
119
|
|
|
120
|
-
:param duration
|
|
120
|
+
:param duration `<'int/float/None'>`: The duration to pause in seconds.
|
|
121
121
|
"""
|
|
122
122
|
if duration is None:
|
|
123
123
|
return None # exit
|
|
@@ -44,7 +44,7 @@ class Connection:
|
|
|
44
44
|
def __init__(self, session: ClientSession, session_timeout: int | float) -> None:
|
|
45
45
|
"""The connection to a remote server (Browser driver).
|
|
46
46
|
|
|
47
|
-
:param session
|
|
47
|
+
:param session `<'ClientSession'>`: The async session of the connection.
|
|
48
48
|
"""
|
|
49
49
|
self._session: ClientSession = session
|
|
50
50
|
self._session_timeout: int | float = session_timeout
|
|
@@ -60,17 +60,17 @@ class Connection:
|
|
|
60
60
|
) -> dict[str, Any]:
|
|
61
61
|
"""Execute a command.
|
|
62
62
|
|
|
63
|
-
:param base_url
|
|
64
|
-
:param command
|
|
65
|
-
:param body
|
|
66
|
-
:param keys
|
|
67
|
-
:param timeout
|
|
63
|
+
:param base_url `<'str'>`: The base url of the command.
|
|
64
|
+
:param command `<'str'>`: The command to execute.
|
|
65
|
+
:param body `<'dict/None'>`: The body of the command. Defaults to `None`.
|
|
66
|
+
:param keys `<'dict/None'>`: The keys to substitute in the command. Defaults to `None`.
|
|
67
|
+
:param timeout `<'int/float/None'>`: Session timeout for command execution. Defaults to `None`.
|
|
68
68
|
This arguments overwrites the default `options.session_timeout`,
|
|
69
69
|
which is designed to cope with a frozen session due to unknown
|
|
70
70
|
errors. For more information about session timeout, please refer
|
|
71
71
|
to the documentation of `options.session_timeout` attribute.
|
|
72
72
|
|
|
73
|
-
:
|
|
73
|
+
:returns `<'dict'>`: The response from the command.
|
|
74
74
|
"""
|
|
75
75
|
# Map command
|
|
76
76
|
method, cmd = self.map_command(command)
|
|
@@ -183,8 +183,8 @@ class Connection:
|
|
|
183
183
|
def map_command(self, command: str) -> tuple[str, str]:
|
|
184
184
|
"""Map a command to its method and commond value.
|
|
185
185
|
|
|
186
|
-
:param command
|
|
187
|
-
:
|
|
186
|
+
:param command `<'str'>`: The command to map.
|
|
187
|
+
:returns `<'tuple'>`: The method and commond value of the command.
|
|
188
188
|
"""
|
|
189
189
|
try:
|
|
190
190
|
return COMMANDS[command]
|