🎵 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.
Release files for mahler 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mahler-0.1.0.tar.gz | 7.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mahler-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.9 kB
Release files / mahler-0.1.0.tar.gz
| Download URL | mahler-0.1.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a4daf254a7bb0482d833a8c0afc200284ff44042856a7f47c23b1068bb9b666
|
|
BLAKE2b-256 checksum How to use checksums |
64f3d581fb2030e68acc625c8726912560e66f19f35964cbc1a83bc5558f028a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.9.6 Windows/10
|
Release files / mahler-0.1.0-py3-none-any.whl
| Download URL | mahler-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce2ad6bd2bc76232d0948167178b4006701af53cbe5f0f7cab35870c624511ac
|
|
BLAKE2b-256 checksum How to use checksums |
bcf449e53e19b964170eb043cb96c1caff843eeb3bffe9fb1fa7285b2ee0ad03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.9.6 Windows/10
|