Web browser automation wrapper.
Project description
🎵 mahler
Web browser automation wrapper.
About
mahler is a web browser automation wrapper that offers a standard API regardless
of what automation suite is being used.
This allows for swapping between automation solutions (playwright, selenium) without having to rewrite the actual browser control code.
mahler is named after Gustav Mahler,
a 19th century composer that wrote some sweet bass solos.
Documentation
See the full documentation.
Quickstart
Run pip install mahler to install package.
Let's launch a browser, visit a site, and click the first link on the page.
from mahler import Controller
controller = Controller(
"playwright",
"chrome",
headless=False,
)
controller.goto("https://example.com")
link = controller.query_selector_all("a")
link.click()
Nice! Now let's change 1 line of code to do it in a different automation suite.
from mahler import Controller
controller = Controller(
"selenium", # Changed
"chrome",
headless=False,
)
controller.goto("https://example.com")
link = controller.query_selector_all("a")
link.click()
A slightly more involved example. Let's login to a website! (Don't worry, these aren't real credentials.)
from mahler import Controller
controller = Controller(
"selenium",
"firefox",
headless=False,
)
controller.goto("https://www.scrapethissite.com/login/")
email_field = controller.query_selector("input#email")
email_field.type_on("jeanluc@ufop.org")
password_field = controller.query_selector("//input[@id='password']")
password_field.type_on("makeitso", delay=0.05)
login_button = controller.query_selector("input[type='submit']")
login_button.click()
Let's change 2 arguments to do it in a different automation suite with a different browser type.
from mahler import Controller
controller = Controller(
"playwright", # Changed
"chrome", # Changed
headless=False,
)
controller.goto("https://www.scrapethissite.com/login/")
email_field = controller.query_selector("input#email")
email_field.type_on("jeanluc@ufop.org")
password_field = controller.query_selector("//input[@id='password']")
password_field.type_on("makeitso", delay=0.05)
login_button = controller.query_selector("input[type='submit']")
login_button.click()
To Do
- Expand fingerprint dataclass and usage to capture and apply full browser fingerprint.
- Add some blackbox functional tests for browser engines.
- Async browser support. Selenium doesn't have a native async implementation and
selenium-asyncis no longer maintained. - Support request interception.
selenium-wireis no longer maintained. - Support mokr when it is fully released.
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 mahler-0.1.0.tar.gz.
File metadata
- Download URL: mahler-0.1.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.6 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a4daf254a7bb0482d833a8c0afc200284ff44042856a7f47c23b1068bb9b666
|
|
| MD5 |
3bb9ef0d7bad0a7ca3cca8ebaa845349
|
|
| BLAKE2b-256 |
64f3d581fb2030e68acc625c8726912560e66f19f35964cbc1a83bc5558f028a
|
File details
Details for the file mahler-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mahler-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.6 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce2ad6bd2bc76232d0948167178b4006701af53cbe5f0f7cab35870c624511ac
|
|
| MD5 |
4ce17bd5837b97cc5cd7aaab8a52a70f
|
|
| BLAKE2b-256 |
bcf449e53e19b964170eb043cb96c1caff843eeb3bffe9fb1fa7285b2ee0ad03
|