Selenium wrapper to streamline usage.
Project description
Seleniumuser
A module that sits ontop of Selenium to streamline scraping and automation workflows.
Install with:
pip install seleniumuser
Currently supports using firefox or chrome.
You will need to have the appropriate web driver executable for the browser and your system in either the system PATH or a location passed to the User class constructor.
They can be found here:
Firefox
Chrome
Basic usage:
Submitting a generic form with fields for first name, last name, email address, and phone number:
from seleniumuser import User user = User(browser_type="firefox") user.get('https://somewebsite.com') user.send_keys('//input[@id="first-name"]', 'Bill') user.fill_next(['Billson', 'bill@bill.com', '5345548486']) user.click('//button[@id="submit"]') try: user.wait_until(lambda: 'Submission Received' in user.text('//p[@id="confirmation-message"]')) print('Submission success.') except TimeoutError: print('Submission failed.') user.close_browser()
The User class supports being used with a context manager if you'd rather not worry about closing the browser before exiting the script:
from seleniumUser import User with User(browser_type="firefox") as user: user.get('https://somewebsite.com') user.send_keys('//input[@id="first-name"]', 'Bill') user.fill_next(['Billson', 'bill@bill.com', '5345548486']) user.click('//button[@id="submit"]') try: user.wait_until(lambda: 'Submission Received' in user.text('//p[@id="confirmation-message"]')) print('Submission success.') except TimeoutError: print('Submission failed.')
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
File details
Details for the file seleniumuser-1.1.3.tar.gz
.
File metadata
- Download URL: seleniumuser-1.1.3.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 047e9d5bea2fdda4d8c836573d669e0082021683c4737d904ea18f9e10684619 |
|
MD5 | e90c10e0c34e04c21bc6f41fc2306682 |
|
BLAKE2b-256 | ab6e3841f94bd56d0857553da1ffc318adf3aefb638d9a9adff08096a3f17b57 |
File details
Details for the file seleniumuser-1.1.3-py3-none-any.whl
.
File metadata
- Download URL: seleniumuser-1.1.3-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d39173a002d62ba8c7ca609ec4d6a81487025849812a43daa7fb0d0eff8d4dc |
|
MD5 | 06dbc4e6806fcbbf77f579c983a4c850 |
|
BLAKE2b-256 | 72128531cee749bcfda5cb5b4398bd28f80915c0755a72ef34231246edc99c46 |