waitless 0.2.0__tar.gz → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Dhiraj Das
3
+ Copyright (c) 2025 Dhiraj Das
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: waitless
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Eliminate explicit waits in UI automation by detecting true UI stability
5
- Author-email: Dhiraj Das <dhirajdas.66@gmail.com>
5
+ Author-email: Dhiraj Das <dhirajdas.666@gmail.com>
6
6
  License: MIT
7
- Project-URL: Homepage, https://github.com/godhiraj-code/waitless
7
+ Project-URL: Homepage, https://www.dhirajdas.dev
8
8
  Project-URL: Documentation, https://github.com/godhiraj-code/waitless#readme
9
9
  Project-URL: Repository, https://github.com/godhiraj-code/waitless.git
10
10
  Project-URL: Issues, https://github.com/godhiraj-code/waitless/issues
@@ -30,6 +30,8 @@ Dynamic: license-file
30
30
 
31
31
  # Waitless
32
32
 
33
+ [![CI](https://github.com/godhiraj-code/waitless/actions/workflows/ci.yml/badge.svg)](https://github.com/godhiraj-code/waitless/actions/workflows/ci.yml)
34
+
33
35
  **Zero-wait UI automation stabilization for Selenium**
34
36
 
35
37
  Eliminate explicit waits and sleeps by automatically detecting true UI stability.
@@ -187,7 +189,7 @@ Sample output:
187
189
 
188
190
  ### Network Threshold Warning
189
191
 
190
- The default `network_idle_threshold=0` means **all** network requests must complete.
192
+ The default `network_idle_threshold=2` allows some background traffic.
191
193
 
192
194
  Many apps have background traffic that never stops:
193
195
  - Analytics calls
@@ -212,7 +214,7 @@ element = driver.find_element(By.ID, "button")
212
214
  original = element.unwrap() # Gets the real WebElement
213
215
  ```
214
216
 
215
- ## v0 Limitations
217
+ ## v0.3 Limitations
216
218
 
217
219
  - **Selenium only** - Playwright support planned for v1
218
220
  - **Sync only** - No async/await support yet
@@ -220,6 +222,8 @@ original = element.unwrap() # Gets the real WebElement
220
222
  - **No Shadow DOM** - MutationObserver doesn't see shadow roots
221
223
  - **No Service Workers** - SW network requests not intercepted
222
224
 
225
+ See [CHANGELOG.md](CHANGELOG.md) for version history.
226
+
223
227
  ## API Reference
224
228
 
225
229
  ### Functions
@@ -1,5 +1,7 @@
1
1
  # Waitless
2
2
 
3
+ [![CI](https://github.com/godhiraj-code/waitless/actions/workflows/ci.yml/badge.svg)](https://github.com/godhiraj-code/waitless/actions/workflows/ci.yml)
4
+
3
5
  **Zero-wait UI automation stabilization for Selenium**
4
6
 
5
7
  Eliminate explicit waits and sleeps by automatically detecting true UI stability.
@@ -157,7 +159,7 @@ Sample output:
157
159
 
158
160
  ### Network Threshold Warning
159
161
 
160
- The default `network_idle_threshold=0` means **all** network requests must complete.
162
+ The default `network_idle_threshold=2` allows some background traffic.
161
163
 
162
164
  Many apps have background traffic that never stops:
163
165
  - Analytics calls
@@ -182,7 +184,7 @@ element = driver.find_element(By.ID, "button")
182
184
  original = element.unwrap() # Gets the real WebElement
183
185
  ```
184
186
 
185
- ## v0 Limitations
187
+ ## v0.3 Limitations
186
188
 
187
189
  - **Selenium only** - Playwright support planned for v1
188
190
  - **Sync only** - No async/await support yet
@@ -190,6 +192,8 @@ original = element.unwrap() # Gets the real WebElement
190
192
  - **No Shadow DOM** - MutationObserver doesn't see shadow roots
191
193
  - **No Service Workers** - SW network requests not intercepted
192
194
 
195
+ See [CHANGELOG.md](CHANGELOG.md) for version history.
196
+
193
197
  ## API Reference
194
198
 
195
199
  ### Functions
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "waitless"
7
- version = "0.2.0"
7
+ version = "0.3.0"
8
8
  description = "Eliminate explicit waits in UI automation by detecting true UI stability"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
11
11
  requires-python = ">=3.9"
12
12
  authors = [
13
- {name = "Dhiraj Das", email = "dhirajdas.66@gmail.com"}
13
+ {name = "Dhiraj Das", email = "dhirajdas.666@gmail.com"}
14
14
  ]
15
15
  keywords = [
16
16
  "selenium",
@@ -36,7 +36,7 @@ classifiers = [
36
36
  ]
37
37
 
38
38
  [project.urls]
39
- Homepage = "https://github.com/godhiraj-code/waitless"
39
+ Homepage = "https://www.dhirajdas.dev"
40
40
  Documentation = "https://github.com/godhiraj-code/waitless#readme"
41
41
  Repository = "https://github.com/godhiraj-code/waitless.git"
42
42
  Issues = "https://github.com/godhiraj-code/waitless/issues"
@@ -36,7 +36,7 @@ Disable:
36
36
  driver = unstabilize(driver) # Back to original behavior
37
37
  """
38
38
 
39
- __version__ = '0.1.0'
39
+ __version__ = '0.3.0'
40
40
  __author__ = 'Dhiraj Das'
41
41
 
42
42
  # Public API
@@ -10,6 +10,21 @@ import threading
10
10
  import logging
11
11
  from typing import Optional, Dict, Any, TYPE_CHECKING
12
12
 
13
+ # Import Selenium exceptions for specific error handling
14
+ try:
15
+ from selenium.common.exceptions import (
16
+ WebDriverException,
17
+ JavascriptException,
18
+ NoSuchWindowException,
19
+ )
20
+ SELENIUM_AVAILABLE = True
21
+ except ImportError:
22
+ # Fallback for when selenium is not installed
23
+ WebDriverException = Exception
24
+ JavascriptException = Exception
25
+ NoSuchWindowException = Exception
26
+ SELENIUM_AVAILABLE = False
27
+
13
28
  from .config import StabilizationConfig, DEFAULT_CONFIG
14
29
  from .signals import SignalEvaluator, StabilityStatus
15
30
  from .instrumentation import (
@@ -86,7 +101,8 @@ class StabilizationEngine:
86
101
  """Get current page URL safely."""
87
102
  try:
88
103
  return self.driver.current_url
89
- except Exception:
104
+ except (WebDriverException, NoSuchWindowException) as e:
105
+ self._debug(f"Could not get current URL: {e}")
90
106
  return ""
91
107
 
92
108
  def _is_instrumentation_alive(self) -> bool:
@@ -99,7 +115,8 @@ class StabilizationEngine:
99
115
  try:
100
116
  result = self.driver.execute_script(CHECK_ALIVE_SCRIPT)
101
117
  return result is True
102
- except Exception:
118
+ except (JavascriptException, WebDriverException, NoSuchWindowException) as e:
119
+ self._debug(f"Instrumentation check failed: {e}")
103
120
  return False
104
121
 
105
122
  def _inject_instrumentation(self) -> None:
@@ -225,10 +225,25 @@ class SeleniumIntegration:
225
225
  Returns:
226
226
  StabilizedWebDriver that auto-waits before interactions
227
227
 
228
+ Raises:
229
+ TypeError: If driver is not a valid WebDriver instance
230
+
228
231
  Note:
229
232
  The returned driver wraps the original but is not a true WebDriver.
230
233
  If you need the original for framework integration, use .unwrapped
231
234
  """
235
+ # Validate driver is a WebDriver-like object
236
+ if driver is None:
237
+ raise TypeError("driver cannot be None")
238
+
239
+ required_attrs = ['execute_script', 'find_element', 'current_url']
240
+ missing = [attr for attr in required_attrs if not hasattr(driver, attr)]
241
+ if missing:
242
+ raise TypeError(
243
+ f"driver does not appear to be a valid WebDriver. "
244
+ f"Missing required attributes: {missing}"
245
+ )
246
+
232
247
  driver_id = id(driver)
233
248
 
234
249
  if driver_id in self._wrapped_drivers:
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: waitless
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Eliminate explicit waits in UI automation by detecting true UI stability
5
- Author-email: Dhiraj Das <dhirajdas.66@gmail.com>
5
+ Author-email: Dhiraj Das <dhirajdas.666@gmail.com>
6
6
  License: MIT
7
- Project-URL: Homepage, https://github.com/godhiraj-code/waitless
7
+ Project-URL: Homepage, https://www.dhirajdas.dev
8
8
  Project-URL: Documentation, https://github.com/godhiraj-code/waitless#readme
9
9
  Project-URL: Repository, https://github.com/godhiraj-code/waitless.git
10
10
  Project-URL: Issues, https://github.com/godhiraj-code/waitless/issues
@@ -30,6 +30,8 @@ Dynamic: license-file
30
30
 
31
31
  # Waitless
32
32
 
33
+ [![CI](https://github.com/godhiraj-code/waitless/actions/workflows/ci.yml/badge.svg)](https://github.com/godhiraj-code/waitless/actions/workflows/ci.yml)
34
+
33
35
  **Zero-wait UI automation stabilization for Selenium**
34
36
 
35
37
  Eliminate explicit waits and sleeps by automatically detecting true UI stability.
@@ -187,7 +189,7 @@ Sample output:
187
189
 
188
190
  ### Network Threshold Warning
189
191
 
190
- The default `network_idle_threshold=0` means **all** network requests must complete.
192
+ The default `network_idle_threshold=2` allows some background traffic.
191
193
 
192
194
  Many apps have background traffic that never stops:
193
195
  - Analytics calls
@@ -212,7 +214,7 @@ element = driver.find_element(By.ID, "button")
212
214
  original = element.unwrap() # Gets the real WebElement
213
215
  ```
214
216
 
215
- ## v0 Limitations
217
+ ## v0.3 Limitations
216
218
 
217
219
  - **Selenium only** - Playwright support planned for v1
218
220
  - **Sync only** - No async/await support yet
@@ -220,6 +222,8 @@ original = element.unwrap() # Gets the real WebElement
220
222
  - **No Shadow DOM** - MutationObserver doesn't see shadow roots
221
223
  - **No Service Workers** - SW network requests not intercepted
222
224
 
225
+ See [CHANGELOG.md](CHANGELOG.md) for version history.
226
+
223
227
  ## API Reference
224
228
 
225
229
  ### Functions
File without changes
File without changes
File without changes
File without changes