Skip to content

matt-manes/seleniumuser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.')

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages