Browser drivers with Python Webdriver Manager

The Blog To Learn Selenium and Test Automation

Browser drivers with Python Webdriver Manager

We all know that we need to have browser drivers, .exe files like chromedriver.exe and geckodriver.exe in case of windows environment or binary files like chromedriver and gheckodriver in case of linux distributions, in order to run our selenium webdriver automation scripts on chrome and firefox browsers.

And also we need to set the path of these files in our script like below or need to add location to the class path.


driver = webdriver.Chrome(executable_path="/path/to/binary/chromedriver")
driver = webdriver.Firefox(executable_path="/path/to/binary/firefoxdriver")

If the path is not defined/given or if the path provided is wrong, we will get an exceptions. And it is mandatory for all browsers to have browser drivers.

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see

To avoid this error, we need to manually download and manage these browser drivers for each operating systems/environments which is very painful and time consuming. Above all we also have to check and update relevant drivers when new versions of the binaries are released or new browsers versions are released along with compatibility for driver to browser.

webdriver_manager by Sergey Pirogov helps us to manage driver related settings automatically for python. This package downloads binaries/executables in an automated way and helps us to avoid all the manual steps that we do previously related to drivers to run our tests.

It supports browsers such as Chrome, Firefox, PhantomJS, Microsoft Edge, or Internet Explorer. You can check that in project page here.

How do we use this in our project?

Only setup required is to install this package using ‘pip’.

pip install webdriver_manager

That’s it! We are all set. Just import this module in your python project and start using it.

For Chrome

from import ChromeDriverManager
from selenium import webdriver

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

For Firefox

from webdriver_manager.firefox import GeckoDriverManager
from selenium import webdriver

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

For Edge

from import EdgeDriverManager
from selenium import webdriver

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

For IE

from import IEDriverManager
from selenium import webdriver

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

webdriver_manager, by default, tries to download the latest version of a given driver binary. To use a specific version of driver, pass the driver version like below.


This eliminates lot of manual works and incompatibility issues. Thanks to Sergey Pirogov. Happy scripting!!!

Don’t forget to provide your valuable comments.


8 Responses

  1. Govind says:

    getting an error message :

    TypeError: install() missing 1 required positional argument: ‘self’

    • admin says:

      install() method is provided by webdriver_manager library. Can you please let me know the browser you tried, to make the debug process easier?

  2. Martin-Pierre Roy says:

    Wow works like a charm!

  3. Heesang Kim says:

    Thank you, this is absolutely perfect!

  4. Assaf says:

    get “unresolved reference webdriver_manager” no matter what i do

  5. Parimala says:

    Can i configure my own path (C:/…….) to download .exe file by webdriver manager? Can someone advise on this?

  6. Philip Bradwell says:

    Works ok when I run from Pycharm but after I use Pyinstaller to package to exe I get a script error on the install

    Any ideas why this could be occuring?



Leave a Reply

Your email address will not be published. Required fields are marked *