Skip to content

Commit e7386ce

Browse files
authored
[py] Update timeouts.py docstrings (#12523)
* [py] Update docstrings in timeouts.py * [py] Fix linting * [py] Implement PR feedback; additional updates to conform more to PEP 257 * [py] Specify that timeouts are in seconds
1 parent d4285d1 commit e7386ce

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

py/selenium/webdriver/common/timeouts.py

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

18-
1918
from typing import TYPE_CHECKING
2019

2120
if TYPE_CHECKING:
@@ -38,13 +37,13 @@ class JSONTimeouts(TypedDict, total=False):
3837

3938

4039
class _TimeoutsDescriptor:
41-
"""TimeoutsDescriptor which gets and sets value of below attributes:
40+
"""Get or set the value of the attributes listed below.
4241
43-
_implicit _timeout
42+
_implicit_wait
4443
_page_load
4544
_script
4645
47-
This does not set the value on the remote end
46+
This does not set the value on the remote end.
4847
"""
4948

5049
def __init__(self, name):
@@ -60,40 +59,46 @@ def __set__(self, obj, value) -> None:
6059

6160
class Timeouts:
6261
def __init__(self, implicit_wait: float = 0, page_load: float = 0, script: float = 0) -> None:
63-
"""Create a new Timeout object.
62+
"""Create a new Timeouts object.
63+
64+
This implements https://w3c.github.io/webdriver/#timeouts.
6465
6566
:Args:
66-
- implicit_wait - Either an int or a float. The number passed in needs to how many
67-
seconds the driver will wait.
68-
- page_load - Either an int or a float. The number passed in needs to how many
69-
seconds the driver will wait.
70-
- script - Either an int or a float. The number passed in needs to how many
71-
seconds the driver will wait.
67+
- implicit_wait - Either an int or a float. Set how many
68+
seconds to wait when searching for elements before
69+
throwing an error.
70+
- page_load - Either an int or a float. Set how many seconds
71+
to wait for a page load to complete before throwing
72+
an error.
73+
- script - Either an int or a float. Set how many seconds to
74+
wait for an asynchronous script to finish execution
75+
before throwing an error.
7276
"""
77+
7378
self.implicit_wait = implicit_wait
7479
self.page_load = page_load
7580
self.script = script
7681

7782
# Creating descriptor objects
7883
implicit_wait = _TimeoutsDescriptor("_implicit_wait")
79-
"""Sets and Gets the value of the implicit_timeout:
84+
"""Get or set how many seconds to wait when searching for elements.
8085
8186
This does not set the value on the remote end.
8287
8388
Usage
8489
-----
8590
- Get
86-
- `self.implicit_timeout`
91+
- `self.implicit_wait`
8792
- Set
88-
- `self.implicit_timeout` = `value`
93+
- `self.implicit_wait` = `value`
8994
9095
Parameters
9196
----------
9297
`value`: `float`
9398
"""
9499

95100
page_load = _TimeoutsDescriptor("_page_load")
96-
"""Sets and Gets the value of page load wait:
101+
"""Get or set how many seconds to wait for the page to load.
97102
98103
This does not set the value on the remote end.
99104
@@ -110,7 +115,7 @@ def __init__(self, implicit_wait: float = 0, page_load: float = 0, script: float
110115
"""
111116

112117
script = _TimeoutsDescriptor("_script")
113-
"""Sets and Gets the value of script wait:
118+
"""Get or set how many seconds to wait for an asynchronous script to finish execution.
114119
115120
This does not set the value on the remote end.
116121

0 commit comments

Comments
 (0)