Giter Club home page Giter Club logo

webdriver_manager's Introduction

python webdriver manager

Build Status PyPI

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

For now support:

  • ChromeDriver

  • GeckoDriver

  • EdgeDriver

  • IEDriver

  • PhantomJS

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

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 required 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())

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 exact driver version that is already in cache ${user_home}/.wdm or set path to the driver using driver_path variable.

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

Config example:

[ChromeDriver]
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, webdriver manager will download it and update path.

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

Example:

GH_TOKEN = "asdasdasdasd"
VERSION = 2.56

This will make your test automation more elegant and robust!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.