Skip to content

tippilab/webdriver_manager

 
 

Repository files navigation

python webdriver manager

Build Status https://pypi.python.org/pypi/webdriver_manager

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

For now support:

  • ChromeDriver

  • GeckoDriver

  • EdgeDriver

  • IEDriver

  • PhantomJS

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

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

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 webdriver_manager.chrome import ChromeDriverManager

webdriver.Chrome(ChromeDriverManager().install())

Use with FireFox:

from webdriver_manager.firefox import GeckoDriverManager

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

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

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

(*) access_token requred to work with Github API more info https://help.github.com/articles/creating-an-access-token-for-command-line-use/. You can set gh_token using config.ini file see Configuration section below.

Use with Edge:

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

Use with IE

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

Use with PhantomJS:

driver = webdriver.PhantomJS(PhantomJsDriverDriverManager().install())

Configuration

Create file ${USER_HOME}/.wdm/config.ini with such content:

[GeckoDriver]
driver_path =
gh_token =
version = latest
offline = False
  • gh_token - Github access token to solve issues with API rate limit

  • driver_path - path to driver that was already downloaded

  • version - by default driver lookup for the latest version of the driver, you can freeze it

  • offline - mode that will disable automatic driver lookup. In this case you need either specify exect driver version that is already in cache ${user_home}/.wdm or set path to the driver using driver_path veariable.

Same variables can be set for [ChromeDriver] and [EdgeDriver]

Config example:

[GeckoDriver]
driver_path = /home/user/.wdm/chromedriver/2.27/chromedriver
gh_token = ada23fsdfdfsdfdf
version = 2.27
offline = True

It will automatically download latest release of chromedriver and set path. Moreover when the new version of the driver will be released, webriver manager will download it and update path.

This will make your test automation more elegant and robust!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%