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
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 seleniumuser-1.1.4.tar.gz.
File metadata
- Download URL: seleniumuser-1.1.4.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b105008558c8c5db0a0b38b5e13af41e3d24f506d8ec3eb902721932e6782215
|
|
| MD5 |
dd8b6d9b595f1d40df1a07b2bb2c6645
|
|
| BLAKE2b-256 |
56434ad2dad1b40891302899e576c806400d27861dff509dfb2cdf65dc52ae18
|
File details
Details for the file seleniumuser-1.1.4-py3-none-any.whl.
File metadata
- Download URL: seleniumuser-1.1.4-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4978672043fe7ad0fbc5661fad07a8c9382d3bff4616b51dad7c46a865ebe376
|
|
| MD5 |
22b0e772edc4eccf19e0b45fd3bb4b43
|
|
| BLAKE2b-256 |
7fb8558090e78dc3fdcbd42b5193c89b620d168a69fe87c42b25d6f5d2c21cb1
|