November 7


Why  Web Driver Manager?

To run our Selenium WebDriver automation scripts on Chrome / Firefox browsers, we must download the binary/.exe files like Chromedriver.exe and geckodriver.exe.

Later we need to set the path of these files in our script like below or its location should be added to the classpath.

Also, if the path is not correctly set you mostly encounter error while executing scripts like shown below:

Error if the path is not set correctly:

The path to the driver executable must be set by the system property

Manually downloading and managing these drivers for each operating system is very painful. We also must check when new versions of the binaries are released / new browsers versions are released. We should check the compatibility for all the executables and add it.

To overcome this drawback of manually maintaining these binaries and setting path in scripts WebDriverManager by Boni Garcia does this for you in automated way without manually checking the new versions and maintaining binaries for all browsers.

What is web driver manager in Selenium?

  • WebDriverManager is aimed at automating the WebDriver binaries management.
  • It downloads the required Driver binary file (if not present locally) into Cache (default location ~/.m2/repository/webdriver)
  • WebDriverManager eliminates the problem of locally storing the driver binaries and maintaining different versions for different browsers.
  • Simply replace System.setProperty() line in the automation with following code WebDriverManager.chromedriver().setup();
  • It supports browsers such as Chrome, Firefox, Opera, PhantomJS, Microsoft Edge, or Internet Explorer.
  • Add import io.github.bonigarcia.wdm.WebDriverManager; into test script file to use webdrivermanager in automation.
Maven Dependency for WebDriverManager

In Maven project, we need to add below dependency into pom.xml.

Link of Maven repository:

Gradle Project for WebDriverManager:

In Gradle project we need to add below code in builde.gradle

Chrome Code Snippet for WebDriverManager:

Below is the code to launch chrome browser using WebDriverManager.

FireFox Code Snippet for WebDriverManager:

Below is the code to launch firefox browser using webdriver manager.

Driver Manager setup commands for various browsers:
  • WebDriverManager.chromedriver().setup();
  • WebDriverManager.firefoxdriver().setup();
  • WebDriverManager.operadriver().setup();
  • WebDriverManager.phantomjs().setup();
  • WebDriverManager.edgedriver().setup();
  • WebDriverManager.iedriver().setup();

When we use WebDriverManager, by default, it tries to download the latest version of a given driver binary.

if you want to use a specific version of driver, we can do that by using


You can force WebDriverManager to download specific versions by changing the value of the variables in for wdm.chromeDriverVersion, wdm.operaDriverVersion, wdm.internetExplorerDriverVersion, or wdm.edgeDriverVersion to a concrete version.

I hope you found this article useful. Please let me know your inputs in the comments section.


You may also like

Groups attribute in TestNG 

Groups attribute in TestNG 
Leave a Reply

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

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}