Skip to main content

Python tool to automate the download of Selenium Web Drivers for all browsers

Project description

auto-selenium

Auto-Selenium is a Python tool to automate the download of Selenium Web Drivers and store the profile sessions for the following browsers:

  • Google Chrome
  • Firefox
  • Opera
  • Brave
  • Edge (only for Windows)

It utilizes Selenium and MSEdge tools

Quickstart examples

Installation

pip install auto-selenium

Simple Usage

from autoselenium import Driver

with Driver('chrome', root='drivers') as driver:
    driver.get('https://www.google.com/')
    # Selenium Webdriver command examples
    driver.find_elements_by_tag_name('div')
    driver.refresh()

Downloads driver based on current version of the browser. When it is used as a context manager, the driver returns Selenium's WebDriver object.

Download specific versions of each driver

from autoselenium import download_driver, get_version

download_driver('firefox', version='0.29.1', root='drivers')
download_driver('opera', 'latest')

cversion = get_version('brave', 'current')
lversion = get_version('brave', 'latest')

if cversion < lversion:
    print('You should update your browser!')

You can specify between 'current', 'latest' or input an specific version for a driver.

Create your custom driver

import autoselenium

class TwitterBot(autoselenium.Driver):
    
    _URL = 'https://twitter.com'
    
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.logged = False
    
    def login_required(func):
        def logged_checker(self, *args, **kwargs):
            if not self.logged:
                self.log()
            return func(self, *args, **kwargs)
        return logged_checker    
    
    def log(self):
        self.logged = True
        pass
    
    @login_required
    def scrape(self):
        pass

Contribute

Would you like to contribute to this project? Here are a few starters:

  • Improve documentation
  • Add Testing examples
  • Bug hunts and refactor
  • Additional features/ More integrations
  • Phantom JS support
  • Implement default browser functions for Mac

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

auto-selenium-1.0.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

auto_selenium-1.0.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file auto-selenium-1.0.0.tar.gz.

File metadata

  • Download URL: auto-selenium-1.0.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

File hashes

Hashes for auto-selenium-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a01e9c1b7864c2d56a2de04ab3d892a4a4ad3d0cf39f22cd3e1505fae8b5a3ba
MD5 0257753ce04a739cf305b2cc2d073cac
BLAKE2b-256 7997ce568f1aff6ef0d5fcade98aa4f158dc241462da8211ba4eaf181854bc11

See more details on using hashes here.

File details

Details for the file auto_selenium-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: auto_selenium-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

File hashes

Hashes for auto_selenium-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b9ee3409a590648ddb8b50b5fedf744c2da0e24743bd0cb8f8a93d601e5b038
MD5 f2384c4ba32af8389ce4a38350bd3d25
BLAKE2b-256 41e800ef0a4d5fe27c40abf6fa744d2cd38de7cad5ad30c7ef7b08a65724d168

See more details on using hashes here.

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