Skip to main content

Module for facilitating download and deploy of WebDriver binaries.

Project description

Python module to facilitate downloading and deploying WebDriver binaries. The classes in this module can be used to automatically search for and download the latest version (or a specific version) of a WebDriver binary (by default, will download to $HOME/webdriver or /usr/local/webdriver if run with sudo. If virtualenv is activated when running webdrivermanager, download is stored within it), extract the binary from the downloaded archive and create a symlink in either /usr/local/bin (if run with sudo) or $HOME/bin.

This project is a fork of https://github.com/leonidessaguisagjr/webdriverdownloader

Installation

This module is available on the Python Package Index (PyPI) and can be installed as follows:

pip install webdrivermanager

Dependencies

This module is dependent on the following additional packages:

Classes

The following classes are available:

  • ChromeDriverManager for downloading and installing chromedriver (for Google Chrome).

  • GeckoDriverManager for downloading and installing geckodriver (for Mozilla Firefox).

  • OperaChromiumDriverManager for downloading and installing operadriver (for Chromium based Opera browsers).

  • EdgeDriverManager for downloading and installing edgedriver (for Microsoft Edge).

Status

Currently being developed/tested using Python 2.7.15 and 3.6.5 on macOS and Windows 10.

Example module usage

Example:

>>> from webdrivermanager import GeckoDriverManager
>>> gdd = GeckoDriverManager()
>>> gdd.download_and_install()
1524kb [00:00, 1631.24kb/s]
('/Users/lsaguisag/webdriver/geckodriver-v0.20.1-macos/geckodriver', '/Users/lsaguisag/bin/geckodriver')
>>> gdd.download_and_install("v0.20.0")
1501kb [00:02, 678.92kb/s]
Symlink /Users/lsaguisag/bin/geckodriver already exists and will be overwritten.
('/Users/lsaguisag/webdriver/geckodriver-v0.20.0-macos/geckodriver', '/Users/lsaguisag/bin/geckodriver')
>>> gdd.download_and_install()
Symlink /Users/lsaguisag/bin/geckodriver already exists and will be overwritten.
('/Users/lsaguisag/webdriver/geckodriver-v0.20.1-macos/geckodriver', '/Users/lsaguisag/bin/geckodriver')
>>>

Command line tool

There is a command-line tool that is also available. After installing the package, it can be used as follows (Windows example):

> webdrivermanager chrome:2.38 firefox opera:v.2.35
Downloading WebDriver for browser: 'chrome'
3300kb [00:00, 11216.38kb/s]
Driver binary downloaded to: C:\Users\lsaguisag\webdriver\chrome\2.38\2.38%2Fchromedriver_win32\chromedriver.exe
Driver copied to: C:\Users\lsaguisag\bin\chromedriver.exe

Downloading WebDriver for browser: 'firefox'
3031kb [00:01, 2253.64kb/s]
Driver binary downloaded to: C:\Users\lsaguisag\webdriver\gecko\v0.20.1\geckodriver-v0.20.1-win64\geckodriver.exe
Driver copied to: C:\Users\lsaguisag\bin\geckodriver.exe

Downloading WebDriver for browser: 'opera'
3548kb [00:02, 1239.02kb/s]
Driver binary downloaded to: C:\Users\lsaguisag\webdriver\operachromium\v.2.35\operadriver_win64\operadriver_win64\operadriver.exe
Driver copied to: C:\Users\lsaguisag\bin\operadriver.exe

WARNING: Path 'C:\Users\lsaguisag\bin' is not in the PATH environment variable.

In the above example, a version was specified for Chrome and Opera while no version was specified for Firefox so the latest version of geckodriver was implicitly downloaded.

Command line options

usage: webdrivermanager [-h] [–downloadpath F] [–linkpath F] [–os OSNAME]

browser [browser …]

Tool for downloading and installing WebDriver binaries.

positional arguments:
browser Browser to download the corresponding WebDriver

binary. Valid values are: “chrome”, “firefox”, “gecko”, “mozilla”, “opera”. Optionally specify a version number of the WebDriver binary as follows: “browser:version” e.g. “chrome:2.39”. If no version number is specified, the latest available version of the WebDriver binary will be downloaded.

optional arguments:
-h, --help

show this help message and exit

--downloadpath F, -d F

Where to download the webdriver binaries

--linkpath F, -l F

Where to link the webdriver binary to.

--os OSNAME, -o OSNAME

Overrides os detection with given os name

TODOs

  • Test on Linux

RELEASES

  • 0.2
    • Initial release, support for installing package directly to python virtualenv directory

    • Added support to set install location via –downloadpath and –linkpath options

  • 0.3
    • Prevent unnecessary calls to webdriver provides when calculating download urls and paths to store them.

    • various code cleanups

  • 0.4
    • Workaround to download firefox & opera webdriver when hitting github api rate limits.

    • Fixed a bug introduced in 0.3: on mac one couldnt download chrome & opera webdriver

    • setup.py fetches requirements from requirements.txt

  • 0.4.1
    • bug fix for dependency installation

  • 0.4.2
    • bug fix for github fallback

  • 0.5.0
    • Basic support for Microsoft Edge

    • Fixed a crash if unsupported browser string was passed (for example: Safari)

  • 0.6.0
    • python module exports available_drivers dict

License

This is released under an MIT license. See the LICENSE file in this repository for more information.

Consult the license terms of the providers of the WebDriver downloads prior to downloading / using the WebDrivers.

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

webdrivermanager-0.6.0.tar.gz (9.9 kB view details)

Uploaded Source

File details

Details for the file webdrivermanager-0.6.0.tar.gz.

File metadata

  • Download URL: webdrivermanager-0.6.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15

File hashes

Hashes for webdrivermanager-0.6.0.tar.gz
Algorithm Hash digest
SHA256 880eec4a14895f71a65969034123e14733e37f2a2eb95b13522961bffb8e634a
MD5 faa9a25fb7c224963765296f3df67a4e
BLAKE2b-256 aada086385d35d7b75bf9960739e9f81c66b7a64a4ae7e6ae2dc12f71c79c667

See more details on using hashes here.

Provenance

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