Skip to main content

Library provides the way to automatically manage drivers for different browsers

Project description

Webdriver Manager for Python

Tests PyPI Supported Python Versions codecov

The main idea is to simplify management of binary drivers for different browsers.

For now support:

  • ChromeDriver

  • GeckoDriver

  • IEDriver

  • OperaDriver

  • EdgeChromiumDriver

Before: You should download binary chromedriver, unzip it somewhere in you PC and set path to this driver like this:

webdriver.Chrome('/home/user/drivers/chromedriver')

ChromeDriverManager(path=custom_path).install()

It’s boring!!! Moreover every time the new version of driver released, you should go and repeat all steps again and again.

With webdriver manager, you just need to do two simple steps:

Install manager:

pip install webdriver_manager

Use with Chrome:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager().install())

Use with Chromium:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import ChromeType

driver = webdriver.Chrome(ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install())

Use with FireFox:

from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager

driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())

Use with IE

from selenium import webdriver
from webdriver_manager.microsoft import IEDriverManager

driver = webdriver.Ie(IEDriverManager().install())

Use with Edge

from selenium import webdriver
from webdriver_manager.microsoft import EdgeChromiumDriverManager

driver = webdriver.Edge(EdgeChromiumDriverManager().install())

Use with Opera

from selenium import webdriver
from webdriver_manager.opera import OperaDriverManager

driver = webdriver.Opera(executable_path=OperaDriverManager().install())

If the Opera browser is installed in a location other than C:/Program Files or C:/Program Files (x86) on windows and /usr/bin/opera for all unix variants and mac, then use the below code,

from selenium import webdriver
from webdriver_manager.opera import OperaDriverManager

options = webdriver.ChromeOptions()
options.add_argument('allow-elevated-browser')
options.binary_location = "C:\\Users\\USERNAME\\FOLDERLOCATION\\Opera\\VERSION\\opera.exe"
driver = webdriver.Opera(executable_path=OperaDriverManager().install(), options=options)

Configuration

If you face error related to github credentials, you need to place github token: (*)

Example:

export GH_TOKEN = "asdasdasdasd"

(*) access_token required to work with Github API more info https://help.github.com/articles/creating-an-access-token-for-command-line-use/.

There is also possibility to set same variables via ENV VARIABLES.

To silent webdriver_manager logs and remove them from console, initialize env variable WDM_LOG_LEVEL with '0' value before your selenium tests:

import os

os.environ['WDM_LOG_LEVEL'] = '0'

or via constructor:

ChromeDriverManager("2.26", log_level=0).install()

By default all driver binaries are saved to user.home/.wdm folder. You can override this setting and save binaries to project.root/.wdm.

import os

os.environ['WDM_LOCAL'] = '1'

Driver cache by default is valid for 1 day. You are able to change this value using constructor parameter:

ChromeDriverManager("2.26", cache_valid_range=1).install()

This will make your test automation more elegant and robust!

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

webdriver_manager-3.2.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webdriver_manager-3.2.1-py2.py3-none-any.whl (16.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file webdriver_manager-3.2.1.tar.gz.

File metadata

  • Download URL: webdriver_manager-3.2.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for webdriver_manager-3.2.1.tar.gz
Algorithm Hash digest
SHA256 0d760c288393786d1654fb587086e7d9c67bf7a376cfae73df0f6cee4144d224
MD5 a13ef747b1eb1c6782a9f8b2efc41692
BLAKE2b-256 6b462de06051cb17a1af0b946f502c3a15b3323a4414700100f1466fc823caaa

See more details on using hashes here.

File details

Details for the file webdriver_manager-3.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: webdriver_manager-3.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for webdriver_manager-3.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ffe423a11f473b1cd3d980cf4d709c6c9960260bba22e9f065e91006ae0d3de9
MD5 2b7a4a7a7155b029da78c5270b78765b
BLAKE2b-256 9c6cb52517f34e907fef503cebe26c93ecdc590d0190b267d38a251a348431e8

See more details on using hashes here.

Supported by

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