A Python package for Selenium automation with action and executor patterns.
Project description
Selenium Package
A Python package for Selenium automation with action and executor patterns.
Features
- BaseAction: Abstract base class for creating Selenium actions
- BaseExecutor: Abstract base class for executing actions with conditions and timeouts
- Exception Handling: Custom exceptions for better error handling
- Type Hints: Full type annotation support
Installation
pip install selenium-package
Usage
Basic Action
from selenium_package import BaseAction
from selenium.webdriver import Chrome
class ClickAction(BaseAction):
def _execute_action(self):
element = self.web_instance.find_element("id", "my-button")
element.click()
return "Button clicked successfully"
# Usage
driver = Chrome()
action = ClickAction(web_instance=driver)
result = action.run()
Basic Executor
from selenium_package import BaseExecutor
class ClickExecutor(BaseExecutor):
def _is_condition_to_stop_met(self, result=None):
return result == "Button clicked successfully"
# Usage
executor = ClickExecutor(
action=ClickAction(web_instance=driver),
timeout=30,
wait_to_verify_condition=1
)
result = executor.run()
Development
Setup
git clone https://github.com/jgabrielsb/selenium-package.git
cd selenium-package
pip install -e ".[dev]"
Running Tests
pytest
Code Formatting
black selenium_package tests
isort selenium_package tests
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
selenium_package-0.0.1.tar.gz
(419.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file selenium_package-0.0.1.tar.gz.
File metadata
- Download URL: selenium_package-0.0.1.tar.gz
- Upload date:
- Size: 419.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4f3581b5c49cbe9da08c5e50a54ee0b818723873f5eef1fecfc84615217e906
|
|
| MD5 |
a2b2968175c4cac63cb2ef5985a789f3
|
|
| BLAKE2b-256 |
0b1841807b3fd7be53697bb2627b28fa89d20085606e4ecfa44a5ac0a10ef1d2
|
File details
Details for the file selenium_package-0.0.1-py3-none-any.whl.
File metadata
- Download URL: selenium_package-0.0.1-py3-none-any.whl
- Upload date:
- Size: 31.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
423487f5c973705b430da0a136882a58b7e7129bd21ee41c5d8777c7794d6223
|
|
| MD5 |
dae51d9781f776b54dcad44ef246bb6f
|
|
| BLAKE2b-256 |
f8c054be56b74b83f60fe53b244d23bda9de6f059d53c2a12ef9ab7986911a77
|