Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seleniumuser-1.1.2.tar.gz (91.8 kB view hashes)

Uploaded Source

Built Distribution

seleniumuser-1.1.2-py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page