selmate 1.0.1__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.
- selmate-1.0.1/LICENSE +21 -0
- selmate-1.0.1/PKG-INFO +140 -0
- selmate-1.0.1/README.md +93 -0
- selmate-1.0.1/pyproject.toml +40 -0
- selmate-1.0.1/selmate/__init__.py +3 -0
- selmate-1.0.1/selmate/composites.py +662 -0
- selmate-1.0.1/selmate/constants.py +329 -0
- selmate-1.0.1/selmate/humanity/constants.py +6 -0
- selmate-1.0.1/selmate/humanity/latency.py +41 -0
- selmate-1.0.1/selmate/js_primitives.py +170 -0
- selmate-1.0.1/selmate/safe_exceptions.py +34 -0
- selmate-1.0.1/selmate/selenium_primitives.py +70 -0
- selmate-1.0.1/selmate/utils.py +165 -0
selmate-1.0.1/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 FINWAX
|
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.
|
selmate-1.0.1/PKG-INFO
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: selmate
|
3
|
+
Version: 1.0.1
|
4
|
+
Summary: A utility library for Selenium WebDriver to enable human-like interactions, robust exception handling, and web automation tasks like popup handling and URL normalization.
|
5
|
+
License: MIT License
|
6
|
+
|
7
|
+
Copyright (c) 2025 FINWAX
|
8
|
+
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
11
|
+
in the Software without restriction, including without limitation the rights
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
14
|
+
furnished to do so, subject to the following conditions:
|
15
|
+
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
17
|
+
copies or substantial portions of the Software.
|
18
|
+
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
25
|
+
SOFTWARE.
|
26
|
+
Keywords: selenium,web automation,human-like,web scraping,browser automation,popup handling,url normalization,testing
|
27
|
+
Author: FINWAX
|
28
|
+
Author-email: waxbid@gmail.com
|
29
|
+
Requires-Python: >=3.10
|
30
|
+
Classifier: Development Status :: 5 - Production/Stable
|
31
|
+
Classifier: Intended Audience :: Developers
|
32
|
+
Classifier: Topic :: Software Development :: Testing
|
33
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
39
|
+
Classifier: Operating System :: OS Independent
|
40
|
+
Requires-Dist: beautifulsoup4 (>=4.13.4,<5.0.0)
|
41
|
+
Requires-Dist: lxml (>=5.4.0,<6.0.0)
|
42
|
+
Requires-Dist: rapidfuzz (>=3.13.0,<4.0.0)
|
43
|
+
Requires-Dist: selenium (>=4.33.0,<5.0.0)
|
44
|
+
Project-URL: Homepage, https://github.com/FINWAX/selmate.py
|
45
|
+
Project-URL: Repository, https://github.com/FINWAX/selmate.py
|
46
|
+
Description-Content-Type: text/markdown
|
47
|
+
|
48
|
+
# Selmate
|
49
|
+
|
50
|
+
Selmate is a Python utility library designed to enhance Selenium WebDriver automation by providing human-like
|
51
|
+
interactions, robust exception handling, and utilities for common web automation tasks. It simplifies interactions with
|
52
|
+
web elements, handles popups, normalizes URLs, and simulates natural user behavior like mouse movements and scrolling.
|
53
|
+
|
54
|
+
## Features
|
55
|
+
|
56
|
+
- **Safe Element Interactions**: Wrappers for Selenium operations (clicks, scrolls, etc.) with built-in exception
|
57
|
+
handling for stale elements, timeouts, and more.
|
58
|
+
- **Human-Like Behavior**: Simulates realistic mouse movements, scrolling, and latency to mimic human interactions.
|
59
|
+
- **Popup Handling**: Automatically detects and handles popup banners, including those within iframes, with options to
|
60
|
+
accept or close them.
|
61
|
+
- **URL Normalization**: Utilities to normalize URLs relative to a base URL, with configurable handling of query
|
62
|
+
strings, fragments, and parameters.
|
63
|
+
- **JavaScript Integration**: Execute JavaScript for advanced interactions like smooth scrolling, element removal, and
|
64
|
+
visibility checks.
|
65
|
+
- **Text Similarity**: Identify confirmation buttons or close buttons using fuzzy text matching.
|
66
|
+
|
67
|
+
## Installation
|
68
|
+
|
69
|
+
Install Selmate via pip:
|
70
|
+
|
71
|
+
```bash
|
72
|
+
pip install selmate
|
73
|
+
```
|
74
|
+
|
75
|
+
## Usage
|
76
|
+
|
77
|
+
Here are some examples of using Selmate's core functionalities:
|
78
|
+
|
79
|
+
### Example 1: Safe Element Click
|
80
|
+
|
81
|
+
```python
|
82
|
+
from selenium import webdriver
|
83
|
+
from selmate.composites import complex_click
|
84
|
+
from selmate.selenium_primitives import find_element_safely
|
85
|
+
from selenium.webdriver.common.by import By
|
86
|
+
|
87
|
+
driver = webdriver.Chrome()
|
88
|
+
driver.get("https://example.com")
|
89
|
+
|
90
|
+
# Safely find and click a button
|
91
|
+
button = find_element_safely(By.ID, "submit-button", driver)
|
92
|
+
if button and complex_click(button, driver):
|
93
|
+
print("Button clicked successfully")
|
94
|
+
|
95
|
+
driver.quit()
|
96
|
+
```
|
97
|
+
|
98
|
+
### Example 2: Handling Popup Banners
|
99
|
+
|
100
|
+
```python
|
101
|
+
from selenium import webdriver
|
102
|
+
from selmate.composites import bypass_popup_banners
|
103
|
+
|
104
|
+
driver = webdriver.Chrome()
|
105
|
+
driver.get("https://example.com")
|
106
|
+
|
107
|
+
# Automatically handle popup banners
|
108
|
+
bypass_popup_banners(driver, observation_capacity=50, success_capacity=3, try_close=True)
|
109
|
+
print("Popups handled")
|
110
|
+
|
111
|
+
driver.quit()
|
112
|
+
```
|
113
|
+
|
114
|
+
### Example 3: Human-Like Mouse Movement
|
115
|
+
|
116
|
+
```python
|
117
|
+
from selenium import webdriver
|
118
|
+
from selmate.composites import wander_between_2_elements
|
119
|
+
from selmate.selenium_primitives import find_element_safely
|
120
|
+
from selenium.webdriver.common.by import By
|
121
|
+
|
122
|
+
driver = webdriver.Chrome()
|
123
|
+
driver.get("https://example.com")
|
124
|
+
|
125
|
+
# Find two elements and simulate mouse movement between them
|
126
|
+
element1 = find_element_safely(By.ID, "element1", driver)
|
127
|
+
element2 = find_element_safely(By.ID, "element2", driver)
|
128
|
+
if element1 and element2:
|
129
|
+
wander_between_2_elements(element1, element2, driver)
|
130
|
+
|
131
|
+
driver.quit()
|
132
|
+
```
|
133
|
+
|
134
|
+
## License
|
135
|
+
|
136
|
+
Selmate is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
137
|
+
|
138
|
+
## Contact
|
139
|
+
|
140
|
+
For questions or support, open an issue or contact the maintainer at waxbid@gmail.com.
|
selmate-1.0.1/README.md
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# Selmate
|
2
|
+
|
3
|
+
Selmate is a Python utility library designed to enhance Selenium WebDriver automation by providing human-like
|
4
|
+
interactions, robust exception handling, and utilities for common web automation tasks. It simplifies interactions with
|
5
|
+
web elements, handles popups, normalizes URLs, and simulates natural user behavior like mouse movements and scrolling.
|
6
|
+
|
7
|
+
## Features
|
8
|
+
|
9
|
+
- **Safe Element Interactions**: Wrappers for Selenium operations (clicks, scrolls, etc.) with built-in exception
|
10
|
+
handling for stale elements, timeouts, and more.
|
11
|
+
- **Human-Like Behavior**: Simulates realistic mouse movements, scrolling, and latency to mimic human interactions.
|
12
|
+
- **Popup Handling**: Automatically detects and handles popup banners, including those within iframes, with options to
|
13
|
+
accept or close them.
|
14
|
+
- **URL Normalization**: Utilities to normalize URLs relative to a base URL, with configurable handling of query
|
15
|
+
strings, fragments, and parameters.
|
16
|
+
- **JavaScript Integration**: Execute JavaScript for advanced interactions like smooth scrolling, element removal, and
|
17
|
+
visibility checks.
|
18
|
+
- **Text Similarity**: Identify confirmation buttons or close buttons using fuzzy text matching.
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Install Selmate via pip:
|
23
|
+
|
24
|
+
```bash
|
25
|
+
pip install selmate
|
26
|
+
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Here are some examples of using Selmate's core functionalities:
|
31
|
+
|
32
|
+
### Example 1: Safe Element Click
|
33
|
+
|
34
|
+
```python
|
35
|
+
from selenium import webdriver
|
36
|
+
from selmate.composites import complex_click
|
37
|
+
from selmate.selenium_primitives import find_element_safely
|
38
|
+
from selenium.webdriver.common.by import By
|
39
|
+
|
40
|
+
driver = webdriver.Chrome()
|
41
|
+
driver.get("https://example.com")
|
42
|
+
|
43
|
+
# Safely find and click a button
|
44
|
+
button = find_element_safely(By.ID, "submit-button", driver)
|
45
|
+
if button and complex_click(button, driver):
|
46
|
+
print("Button clicked successfully")
|
47
|
+
|
48
|
+
driver.quit()
|
49
|
+
```
|
50
|
+
|
51
|
+
### Example 2: Handling Popup Banners
|
52
|
+
|
53
|
+
```python
|
54
|
+
from selenium import webdriver
|
55
|
+
from selmate.composites import bypass_popup_banners
|
56
|
+
|
57
|
+
driver = webdriver.Chrome()
|
58
|
+
driver.get("https://example.com")
|
59
|
+
|
60
|
+
# Automatically handle popup banners
|
61
|
+
bypass_popup_banners(driver, observation_capacity=50, success_capacity=3, try_close=True)
|
62
|
+
print("Popups handled")
|
63
|
+
|
64
|
+
driver.quit()
|
65
|
+
```
|
66
|
+
|
67
|
+
### Example 3: Human-Like Mouse Movement
|
68
|
+
|
69
|
+
```python
|
70
|
+
from selenium import webdriver
|
71
|
+
from selmate.composites import wander_between_2_elements
|
72
|
+
from selmate.selenium_primitives import find_element_safely
|
73
|
+
from selenium.webdriver.common.by import By
|
74
|
+
|
75
|
+
driver = webdriver.Chrome()
|
76
|
+
driver.get("https://example.com")
|
77
|
+
|
78
|
+
# Find two elements and simulate mouse movement between them
|
79
|
+
element1 = find_element_safely(By.ID, "element1", driver)
|
80
|
+
element2 = find_element_safely(By.ID, "element2", driver)
|
81
|
+
if element1 and element2:
|
82
|
+
wander_between_2_elements(element1, element2, driver)
|
83
|
+
|
84
|
+
driver.quit()
|
85
|
+
```
|
86
|
+
|
87
|
+
## License
|
88
|
+
|
89
|
+
Selmate is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
90
|
+
|
91
|
+
## Contact
|
92
|
+
|
93
|
+
For questions or support, open an issue or contact the maintainer at waxbid@gmail.com.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
[project]
|
2
|
+
name = "selmate"
|
3
|
+
version = "1.0.1"
|
4
|
+
description = "A utility library for Selenium WebDriver to enable human-like interactions, robust exception handling, and web automation tasks like popup handling and URL normalization."
|
5
|
+
authors = [{ name = "FINWAX", email = "waxbid@gmail.com" }]
|
6
|
+
license = { file = "LICENSE" }
|
7
|
+
readme = "README.md"
|
8
|
+
requires-python = ">=3.10"
|
9
|
+
dependencies = [
|
10
|
+
"selenium (>=4.33.0,<5.0.0)",
|
11
|
+
"rapidfuzz (>=3.13.0,<4.0.0)",
|
12
|
+
"beautifulsoup4 (>=4.13.4,<5.0.0)",
|
13
|
+
"lxml (>=5.4.0,<6.0.0)"
|
14
|
+
]
|
15
|
+
keywords = ["selenium", "web automation", "human-like", "web scraping", "browser automation", "popup handling", "url normalization", "testing"]
|
16
|
+
classifiers = [
|
17
|
+
"Development Status :: 5 - Production/Stable",
|
18
|
+
"Intended Audience :: Developers",
|
19
|
+
"Topic :: Software Development :: Testing",
|
20
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
21
|
+
"License :: OSI Approved :: MIT License",
|
22
|
+
"Programming Language :: Python :: 3",
|
23
|
+
"Programming Language :: Python :: 3.10",
|
24
|
+
"Programming Language :: Python :: 3.11",
|
25
|
+
"Programming Language :: Python :: 3.12",
|
26
|
+
"Operating System :: OS Independent",
|
27
|
+
]
|
28
|
+
|
29
|
+
[project.urls]
|
30
|
+
Homepage = "https://github.com/FINWAX/selmate.py"
|
31
|
+
Repository = "https://github.com/FINWAX/selmate.py"
|
32
|
+
|
33
|
+
[tool.poetry]
|
34
|
+
|
35
|
+
[tool.poetry.group.dev.dependencies]
|
36
|
+
docker-chrome-session-manager = "^1.0.2"
|
37
|
+
|
38
|
+
[build-system]
|
39
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
40
|
+
build-backend = "poetry.core.masonry.api"
|