A lightweight Selenium wrapper for web automation
Project description
ausrine
A lightweight Selenium wrapper for web automation.
ausrine is designed to simplify web automation tasks by wrapping Selenium's functionality into an intuitive and easy-to-use API. Whether you're scraping data, testing web applications, or automating repetitive browser tasks, ausrine provides a streamlined experience with minimal setup.
Installation
Install ausrine using pip:
pip install ausrine
ausrine uses selenium>=4.0.0 with Selenium Manager, which automatically manages WebDriver dependencies. No additional setup is required beyond installation.
Usage
ausrine simplifies web automation with Selenium by providing an intuitive WebAutomationDriver class. Below is an example of performing a Bing search:
from ausrine import WebAutomationDriver
from ausrine.chrome import setup_webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
# Initialize Chrome WebDriver
driver = setup_webdriver()
# Create WebAutomationDriver instance
ausrine = WebAutomationDriver(driver)
# Navigate to Bing
ausrine.get("https://www.bing.com/?cc=jp")
# Find the search box, type "iphone", and press Enter
ausrine.send_keys(by=By.NAME, value="q", text="iphone")
ausrine.send_keys(by=By.NAME, value="q", text=Keys.ENTER)
# Quit the driver
ausrine.quit()
You can also execute a sequence of commands using execute:
sequences = [
{"get": {"url": "https://www.bing.com/?cc=jp"}},
{"send_keys": {"by": By.NAME, "value": "q", "text": "iphone"}},
{"send_keys": {"by": By.NAME, "value": "q", "text": Keys.ENTER}},
]
ausrine = WebAutomationDriver(setup_webdriver())
ausrine.execute(sequences)
ausrine.quit()
For error handling, use try_execute:
sequences = [
{"get": {"url": "https://www.bing.com/?cc=jp"}},
{"send_keys": {"by": By.NAME, "value": "q", "text": "iphone"}},
{"send_keys": {"by": By.NAME, "value": "q", "text": Keys.ENTER}},
]
ausrine = WebAutomationDriver(setup_webdriver())
error = ausrine.try_execute(sequences)
if error:
print(f"An error occurred: {error}")
else:
print("Execution completed successfully")
ausrine.quit()
Form submission example
Below is an example of submitting a login form:
from ausrine import WebAutomationDriver
from ausrine.chrome import setup_webdriver
from selenium.webdriver.common.by import By
# Initialize Chrome WebDriver
driver = setup_webdriver()
# Create WebAutomationDriver instance
ausrine = WebAutomationDriver(driver)
# Navigate to a login page
ausrine.get("https://example.com/login")
# Fill in username and password, then submit
ausrine.send_keys(by=By.ID, value="username", text="user")
ausrine.send_keys(by=By.ID, value="password", text="pass", password=True)
ausrine.submit(by=By.ID, value="login-btn")
# Quit the driver
ausrine.quit()
Features
- Simple API: Intuitive methods like
get,click,send_keys, andsubmitfor common web tasks. - Sequence Execution: Chain multiple commands with
executeortry_executefor robust automation. - Customizable WebDriver: Configure Chrome with options like headless mode or custom download directories via
setup_webdriver. - Lightweight: Minimal dependencies (only Selenium) and a focused feature set.
Requirements
- Python >= 3.10
- Selenium >= 4.0.0, < 5.0.0
License
This project is licensed under the terms of the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md file for details and submit issues or pull requests to the GitHub repository.
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
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 ausrine-0.1.0.tar.gz.
File metadata
- Download URL: ausrine-0.1.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
023defbbb814460f99d8618dab19c92d63b55334e0935924fb2352396db9c43c
|
|
| MD5 |
8602f1d4db98bd386c8ad5b4937b3688
|
|
| BLAKE2b-256 |
acb9ebd5a18168a83de887b5917206f02551182c773d27ff8a2c229a1d3a1aab
|
File details
Details for the file ausrine-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ausrine-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fe6a025389496e20de8c089c188f772b3cca6ebff945a0d19d953da166e22e2
|
|
| MD5 |
77b1403753cf1aa1fab78358d99b1a9f
|
|
| BLAKE2b-256 |
f53abfc19307863313845674c09569a8062219d8e1462ae970e0a5d6d3445c58
|