selenium-autowait 0.1.0__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.
- selenium_autowait-0.1.0/.gitignore +13 -0
- selenium_autowait-0.1.0/.python-version +1 -0
- selenium_autowait-0.1.0/LICENSE +21 -0
- selenium_autowait-0.1.0/PKG-INFO +268 -0
- selenium_autowait-0.1.0/README.md +241 -0
- selenium_autowait-0.1.0/pyproject.toml +80 -0
- selenium_autowait-0.1.0/src/selenium_autowait/__init__.py +2 -0
- selenium_autowait-0.1.0/src/selenium_autowait/autowait.py +140 -0
- selenium_autowait-0.1.0/src/selenium_autowait/pytest_plugin.py +12 -0
- selenium_autowait-0.1.0/tests/autowait.html +57 -0
- selenium_autowait-0.1.0/tests/conftest.py +15 -0
- selenium_autowait-0.1.0/tests/test_autowait.py +73 -0
- selenium_autowait-0.1.0/tests/test_autowait_state.py +59 -0
- selenium_autowait-0.1.0/uv.lock +511 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Volodymyr Obrizan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: selenium-autowait
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Adds automatic waiting to common Selenium interactions.
|
|
5
|
+
Project-URL: Homepage, https://github.com/obrizan/selenium-autowait
|
|
6
|
+
Project-URL: Repository, https://github.com/obrizan/selenium-autowait
|
|
7
|
+
Project-URL: Issues, https://github.com/obrizan/selenium-autowait/issues
|
|
8
|
+
Author-email: Volodymyr Obrizan <obrizan@first.institute>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: pytest,selenium,testing,wait,webdriver
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Framework :: Pytest
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: selenium>=4.33.0
|
|
24
|
+
Provides-Extra: pytest
|
|
25
|
+
Requires-Dist: pytest>=7; extra == 'pytest'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# selenium-autowait
|
|
29
|
+
|
|
30
|
+
`selenium-autowait` adds automatic waiting to common Selenium interactions.
|
|
31
|
+
|
|
32
|
+
After autowait is enabled, Selenium waits before calling:
|
|
33
|
+
|
|
34
|
+
| Method | Wait condition |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `WebDriver.find_element` | Until the element is found |
|
|
37
|
+
| `WebElement.click` | Until the element is clickable |
|
|
38
|
+
| `WebElement.send_keys` | Until the element is clickable |
|
|
39
|
+
| `WebElement.clear` | Until the element is clickable |
|
|
40
|
+
|
|
41
|
+
This is useful for tests where elements may appear, become enabled, or become
|
|
42
|
+
clickable shortly after the page changes.
|
|
43
|
+
|
|
44
|
+
## Table of contents
|
|
45
|
+
|
|
46
|
+
- [Installation](#installation)
|
|
47
|
+
- [Usage](#usage)
|
|
48
|
+
- [Plain Python](#plain-python)
|
|
49
|
+
- [unittest](#unittest)
|
|
50
|
+
- [pytest](#pytest)
|
|
51
|
+
- [Analyze test results with Testinel](#analyze-test-results-with-testinel)
|
|
52
|
+
- [Testing](#testing)
|
|
53
|
+
- [Notes](#notes)
|
|
54
|
+
- [Disclaimer](#disclaimer)
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
Install the base package from PyPI:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install selenium-autowait
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or with `uv`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uv add selenium-autowait
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The base package requires Python 3.11 or newer and depends on Selenium. Pytest
|
|
71
|
+
support is optional.
|
|
72
|
+
|
|
73
|
+
To use the bundled pytest fixture, install the pytest extra:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install "selenium-autowait[pytest]"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Or with `uv`:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
uv add "selenium-autowait[pytest]"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Usage
|
|
86
|
+
|
|
87
|
+
Autowait works by globally monkey-patching Selenium's `WebDriver` and
|
|
88
|
+
`WebElement` classes. Enable it before the Selenium interactions that should
|
|
89
|
+
wait automatically, and disable it when that behavior is no longer needed.
|
|
90
|
+
|
|
91
|
+
The default timeout is `10.0` seconds. To change it, pass `timeout` when
|
|
92
|
+
enabling autowait:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from selenium_autowait import enable_autowait
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
enable_autowait(timeout=5.0)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Plain Python
|
|
102
|
+
|
|
103
|
+
Enable autowait before interacting with Selenium elements:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from selenium import webdriver
|
|
107
|
+
from selenium.webdriver.common.by import By
|
|
108
|
+
from selenium_autowait import disable_autowait, enable_autowait
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
driver = webdriver.Chrome()
|
|
112
|
+
enable_autowait()
|
|
113
|
+
|
|
114
|
+
driver.get("https://example.com")
|
|
115
|
+
button = driver.find_element(By.ID, "submit")
|
|
116
|
+
|
|
117
|
+
# Will wait until the button is clickable.
|
|
118
|
+
button.click()
|
|
119
|
+
disable_autowait()
|
|
120
|
+
driver.quit()
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### unittest
|
|
124
|
+
|
|
125
|
+
Enable autowait once for the test class in `setUpClass`, then disable it in
|
|
126
|
+
`tearDownClass`:
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
import unittest
|
|
130
|
+
|
|
131
|
+
from selenium import webdriver
|
|
132
|
+
from selenium.webdriver.common.by import By
|
|
133
|
+
from selenium.webdriver.remote.webdriver import WebDriver
|
|
134
|
+
from selenium_autowait import disable_autowait, enable_autowait
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class SubmitTests(unittest.TestCase):
|
|
138
|
+
driver: WebDriver
|
|
139
|
+
|
|
140
|
+
@classmethod
|
|
141
|
+
def setUpClass(cls) -> None:
|
|
142
|
+
enable_autowait()
|
|
143
|
+
cls.driver = webdriver.Chrome()
|
|
144
|
+
|
|
145
|
+
@classmethod
|
|
146
|
+
def tearDownClass(cls) -> None:
|
|
147
|
+
cls.driver.quit()
|
|
148
|
+
disable_autowait()
|
|
149
|
+
|
|
150
|
+
def test_submit(self) -> None:
|
|
151
|
+
self.driver.get("https://example.com")
|
|
152
|
+
self.driver.find_element(By.ID, "submit").click()
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### pytest
|
|
156
|
+
|
|
157
|
+
If installed with the `pytest` extra, the package exposes an `autowait` fixture
|
|
158
|
+
through pytest's plugin entry point. Use the fixture in tests that should wait
|
|
159
|
+
automatically:
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
from selenium.webdriver.common.by import By
|
|
163
|
+
from selenium.webdriver.remote.webdriver import WebDriver
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def test_submit(driver: WebDriver, autowait: None) -> None:
|
|
167
|
+
driver.get("https://example.com")
|
|
168
|
+
driver.find_element(By.ID, "submit").click()
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
You can also define the fixture yourself if you prefer local control:
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
from collections.abc import Generator
|
|
175
|
+
|
|
176
|
+
import pytest
|
|
177
|
+
|
|
178
|
+
from selenium_autowait import disable_autowait, enable_autowait
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
@pytest.fixture
|
|
182
|
+
def autowait() -> Generator[None, None, None]:
|
|
183
|
+
enable_autowait(timeout=10.0)
|
|
184
|
+
yield
|
|
185
|
+
disable_autowait()
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
To enable autowait once for the whole pytest session, define a session-scoped
|
|
189
|
+
fixture in `conftest.py`:
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
from collections.abc import Generator
|
|
193
|
+
|
|
194
|
+
import pytest
|
|
195
|
+
|
|
196
|
+
from selenium_autowait import disable_autowait, enable_autowait
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
@pytest.fixture(scope="session", autouse=True)
|
|
200
|
+
def autowait_session() -> Generator[None, None, None]:
|
|
201
|
+
enable_autowait(timeout=10.0)
|
|
202
|
+
yield
|
|
203
|
+
disable_autowait()
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Analyze test results with Testinel
|
|
207
|
+
|
|
208
|
+
`selenium-autowait` helps reduce flaky Selenium failures caused by elements that
|
|
209
|
+
are not ready yet. When failures still happen, [Testinel](https://testinel.dev/)
|
|
210
|
+
can help you understand them faster.
|
|
211
|
+
|
|
212
|
+
Testinel is a web-based analytics platform for automated testing. It turns test
|
|
213
|
+
runs, logs, and failures into actionable reports, helping teams identify
|
|
214
|
+
recurring root causes, review historical stability trends, and navigate from
|
|
215
|
+
high-level test health to exact failing tests and logs.
|
|
216
|
+
|
|
217
|
+
Testinel supports Python, pytest, Selenium, and Playwright-based test workflows.
|
|
218
|
+
|
|
219
|
+
## Testing
|
|
220
|
+
|
|
221
|
+
Install the development dependencies with `uv`:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
uv sync --group dev
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Run the default test matrix with tox:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
uv run tox
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The tox matrix covers Python 3.11 through 3.15, pytest 8 and 9, the minimum
|
|
234
|
+
supported pytest version, the minimum supported Selenium version, and the latest
|
|
235
|
+
available Selenium version. The tests use Chrome through Selenium, so Chrome and
|
|
236
|
+
WebDriver support must be available on the test machine.
|
|
237
|
+
|
|
238
|
+
To run a single environment:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
uv run tox -e py314-pytest9-seleniumlatest
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Before publishing a release, run:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
uv run pytest
|
|
248
|
+
uv run ruff check .
|
|
249
|
+
uv run ty check .
|
|
250
|
+
uv build
|
|
251
|
+
uvx --from twine twine check dist/*
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Notes
|
|
255
|
+
|
|
256
|
+
- Autowait globally monkey-patches Selenium `WebElement` and `WebDriver`
|
|
257
|
+
methods.
|
|
258
|
+
- Call `enable_autowait()` once before using autowaited Selenium interactions.
|
|
259
|
+
- Calling `enable_autowait()` more than once raises `RuntimeError`.
|
|
260
|
+
- Calling `disable_autowait()` when autowait is not enabled raises
|
|
261
|
+
`RuntimeError`.
|
|
262
|
+
- Passing a non-positive timeout raises `ValueError`.
|
|
263
|
+
- `click`, `send_keys`, and `clear` wait until the element is clickable before
|
|
264
|
+
performing the original Selenium action.
|
|
265
|
+
|
|
266
|
+
## Disclaimer
|
|
267
|
+
|
|
268
|
+
Selenium is a trademark of its respective owners. `selenium-autowait` is an independent third-party plugin for Selenium and is not affiliated with, endorsed by, or sponsored by the Selenium project or its maintainers. The Selenium name is used solely to describe compatibility with Selenium.
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# selenium-autowait
|
|
2
|
+
|
|
3
|
+
`selenium-autowait` adds automatic waiting to common Selenium interactions.
|
|
4
|
+
|
|
5
|
+
After autowait is enabled, Selenium waits before calling:
|
|
6
|
+
|
|
7
|
+
| Method | Wait condition |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `WebDriver.find_element` | Until the element is found |
|
|
10
|
+
| `WebElement.click` | Until the element is clickable |
|
|
11
|
+
| `WebElement.send_keys` | Until the element is clickable |
|
|
12
|
+
| `WebElement.clear` | Until the element is clickable |
|
|
13
|
+
|
|
14
|
+
This is useful for tests where elements may appear, become enabled, or become
|
|
15
|
+
clickable shortly after the page changes.
|
|
16
|
+
|
|
17
|
+
## Table of contents
|
|
18
|
+
|
|
19
|
+
- [Installation](#installation)
|
|
20
|
+
- [Usage](#usage)
|
|
21
|
+
- [Plain Python](#plain-python)
|
|
22
|
+
- [unittest](#unittest)
|
|
23
|
+
- [pytest](#pytest)
|
|
24
|
+
- [Analyze test results with Testinel](#analyze-test-results-with-testinel)
|
|
25
|
+
- [Testing](#testing)
|
|
26
|
+
- [Notes](#notes)
|
|
27
|
+
- [Disclaimer](#disclaimer)
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
Install the base package from PyPI:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install selenium-autowait
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or with `uv`:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
uv add selenium-autowait
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The base package requires Python 3.11 or newer and depends on Selenium. Pytest
|
|
44
|
+
support is optional.
|
|
45
|
+
|
|
46
|
+
To use the bundled pytest fixture, install the pytest extra:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install "selenium-autowait[pytest]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or with `uv`:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uv add "selenium-autowait[pytest]"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
Autowait works by globally monkey-patching Selenium's `WebDriver` and
|
|
61
|
+
`WebElement` classes. Enable it before the Selenium interactions that should
|
|
62
|
+
wait automatically, and disable it when that behavior is no longer needed.
|
|
63
|
+
|
|
64
|
+
The default timeout is `10.0` seconds. To change it, pass `timeout` when
|
|
65
|
+
enabling autowait:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from selenium_autowait import enable_autowait
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
enable_autowait(timeout=5.0)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Plain Python
|
|
75
|
+
|
|
76
|
+
Enable autowait before interacting with Selenium elements:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from selenium import webdriver
|
|
80
|
+
from selenium.webdriver.common.by import By
|
|
81
|
+
from selenium_autowait import disable_autowait, enable_autowait
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
driver = webdriver.Chrome()
|
|
85
|
+
enable_autowait()
|
|
86
|
+
|
|
87
|
+
driver.get("https://example.com")
|
|
88
|
+
button = driver.find_element(By.ID, "submit")
|
|
89
|
+
|
|
90
|
+
# Will wait until the button is clickable.
|
|
91
|
+
button.click()
|
|
92
|
+
disable_autowait()
|
|
93
|
+
driver.quit()
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### unittest
|
|
97
|
+
|
|
98
|
+
Enable autowait once for the test class in `setUpClass`, then disable it in
|
|
99
|
+
`tearDownClass`:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import unittest
|
|
103
|
+
|
|
104
|
+
from selenium import webdriver
|
|
105
|
+
from selenium.webdriver.common.by import By
|
|
106
|
+
from selenium.webdriver.remote.webdriver import WebDriver
|
|
107
|
+
from selenium_autowait import disable_autowait, enable_autowait
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class SubmitTests(unittest.TestCase):
|
|
111
|
+
driver: WebDriver
|
|
112
|
+
|
|
113
|
+
@classmethod
|
|
114
|
+
def setUpClass(cls) -> None:
|
|
115
|
+
enable_autowait()
|
|
116
|
+
cls.driver = webdriver.Chrome()
|
|
117
|
+
|
|
118
|
+
@classmethod
|
|
119
|
+
def tearDownClass(cls) -> None:
|
|
120
|
+
cls.driver.quit()
|
|
121
|
+
disable_autowait()
|
|
122
|
+
|
|
123
|
+
def test_submit(self) -> None:
|
|
124
|
+
self.driver.get("https://example.com")
|
|
125
|
+
self.driver.find_element(By.ID, "submit").click()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### pytest
|
|
129
|
+
|
|
130
|
+
If installed with the `pytest` extra, the package exposes an `autowait` fixture
|
|
131
|
+
through pytest's plugin entry point. Use the fixture in tests that should wait
|
|
132
|
+
automatically:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from selenium.webdriver.common.by import By
|
|
136
|
+
from selenium.webdriver.remote.webdriver import WebDriver
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def test_submit(driver: WebDriver, autowait: None) -> None:
|
|
140
|
+
driver.get("https://example.com")
|
|
141
|
+
driver.find_element(By.ID, "submit").click()
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
You can also define the fixture yourself if you prefer local control:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
from collections.abc import Generator
|
|
148
|
+
|
|
149
|
+
import pytest
|
|
150
|
+
|
|
151
|
+
from selenium_autowait import disable_autowait, enable_autowait
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
@pytest.fixture
|
|
155
|
+
def autowait() -> Generator[None, None, None]:
|
|
156
|
+
enable_autowait(timeout=10.0)
|
|
157
|
+
yield
|
|
158
|
+
disable_autowait()
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
To enable autowait once for the whole pytest session, define a session-scoped
|
|
162
|
+
fixture in `conftest.py`:
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from collections.abc import Generator
|
|
166
|
+
|
|
167
|
+
import pytest
|
|
168
|
+
|
|
169
|
+
from selenium_autowait import disable_autowait, enable_autowait
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@pytest.fixture(scope="session", autouse=True)
|
|
173
|
+
def autowait_session() -> Generator[None, None, None]:
|
|
174
|
+
enable_autowait(timeout=10.0)
|
|
175
|
+
yield
|
|
176
|
+
disable_autowait()
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Analyze test results with Testinel
|
|
180
|
+
|
|
181
|
+
`selenium-autowait` helps reduce flaky Selenium failures caused by elements that
|
|
182
|
+
are not ready yet. When failures still happen, [Testinel](https://testinel.dev/)
|
|
183
|
+
can help you understand them faster.
|
|
184
|
+
|
|
185
|
+
Testinel is a web-based analytics platform for automated testing. It turns test
|
|
186
|
+
runs, logs, and failures into actionable reports, helping teams identify
|
|
187
|
+
recurring root causes, review historical stability trends, and navigate from
|
|
188
|
+
high-level test health to exact failing tests and logs.
|
|
189
|
+
|
|
190
|
+
Testinel supports Python, pytest, Selenium, and Playwright-based test workflows.
|
|
191
|
+
|
|
192
|
+
## Testing
|
|
193
|
+
|
|
194
|
+
Install the development dependencies with `uv`:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
uv sync --group dev
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Run the default test matrix with tox:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
uv run tox
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The tox matrix covers Python 3.11 through 3.15, pytest 8 and 9, the minimum
|
|
207
|
+
supported pytest version, the minimum supported Selenium version, and the latest
|
|
208
|
+
available Selenium version. The tests use Chrome through Selenium, so Chrome and
|
|
209
|
+
WebDriver support must be available on the test machine.
|
|
210
|
+
|
|
211
|
+
To run a single environment:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
uv run tox -e py314-pytest9-seleniumlatest
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Before publishing a release, run:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
uv run pytest
|
|
221
|
+
uv run ruff check .
|
|
222
|
+
uv run ty check .
|
|
223
|
+
uv build
|
|
224
|
+
uvx --from twine twine check dist/*
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Notes
|
|
228
|
+
|
|
229
|
+
- Autowait globally monkey-patches Selenium `WebElement` and `WebDriver`
|
|
230
|
+
methods.
|
|
231
|
+
- Call `enable_autowait()` once before using autowaited Selenium interactions.
|
|
232
|
+
- Calling `enable_autowait()` more than once raises `RuntimeError`.
|
|
233
|
+
- Calling `disable_autowait()` when autowait is not enabled raises
|
|
234
|
+
`RuntimeError`.
|
|
235
|
+
- Passing a non-positive timeout raises `ValueError`.
|
|
236
|
+
- `click`, `send_keys`, and `clear` wait until the element is clickable before
|
|
237
|
+
performing the original Selenium action.
|
|
238
|
+
|
|
239
|
+
## Disclaimer
|
|
240
|
+
|
|
241
|
+
Selenium is a trademark of its respective owners. `selenium-autowait` is an independent third-party plugin for Selenium and is not affiliated with, endorsed by, or sponsored by the Selenium project or its maintainers. The Selenium name is used solely to describe compatibility with Selenium.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "selenium-autowait"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Adds automatic waiting to common Selenium interactions."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
authors = [
|
|
8
|
+
{ name="Volodymyr Obrizan", email="obrizan@first.institute" },
|
|
9
|
+
]
|
|
10
|
+
keywords = ["selenium", "testing", "pytest", "wait", "webdriver"]
|
|
11
|
+
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Framework :: Pytest",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Topic :: Software Development :: Testing",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
dependencies = [
|
|
26
|
+
"selenium>=4.33.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
license = "MIT"
|
|
30
|
+
license-files = ["LICENSE"]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
pytest = [
|
|
34
|
+
"pytest>=7",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/obrizan/selenium-autowait"
|
|
39
|
+
Repository = "https://github.com/obrizan/selenium-autowait"
|
|
40
|
+
Issues = "https://github.com/obrizan/selenium-autowait/issues"
|
|
41
|
+
|
|
42
|
+
[project.entry-points.pytest11]
|
|
43
|
+
selenium-autowait = "selenium_autowait.pytest_plugin"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
[build-system]
|
|
47
|
+
requires = ["hatchling"]
|
|
48
|
+
build-backend = "hatchling.build"
|
|
49
|
+
|
|
50
|
+
[dependency-groups]
|
|
51
|
+
dev = [
|
|
52
|
+
"pytest>=9.0.3",
|
|
53
|
+
"ruff>=0.15.16",
|
|
54
|
+
"tox>=4.55.1",
|
|
55
|
+
"tox-uv>=1.35.2",
|
|
56
|
+
"ty>=0.0.44",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[tool.tox]
|
|
60
|
+
legacy_tox_ini = """
|
|
61
|
+
[tox]
|
|
62
|
+
requires =
|
|
63
|
+
tox>=4.55.1
|
|
64
|
+
tox-uv>=1.35.2
|
|
65
|
+
envlist =
|
|
66
|
+
py{311,312,313,314,315}-pytest{8,9}-seleniumlatest
|
|
67
|
+
py311-pytestmin-seleniummin
|
|
68
|
+
|
|
69
|
+
[testenv]
|
|
70
|
+
extras =
|
|
71
|
+
pytest
|
|
72
|
+
deps =
|
|
73
|
+
pytestmin: pytest==7.0.0
|
|
74
|
+
pytest8: pytest>=8,<9
|
|
75
|
+
pytest9: pytest>=9,<10
|
|
76
|
+
seleniummin: selenium==4.33.0
|
|
77
|
+
seleniumlatest: selenium>=4.33.0
|
|
78
|
+
commands =
|
|
79
|
+
pytest {posargs:tests}
|
|
80
|
+
"""
|