WebDriverManager is an API that allows users to automate the handling of driver executables like chromedriver.exe, geckodriver.exe etc required by Selenium WebDriver API.

Now let us see, how can we set path for driver executables for different browsers like Chrome, Firefox etc. in a traditional way.

In general, to automate web applications we need to download driver executables manually for required browsers. Once driver executables are downloaded into local system then we need place them in a specific path and set path for driver executables that becomes very tedious task to maintain driver executables as and when browser version changes.

In below code, we can see how to set path for driver executables in a traditional way.

//For Chrome Browser
System.setProperty("webdriver.chrome.driver", "./Drivers/chromedriver.exe");

//For Internet Explorer Browser
System.setProperty("webdriver.ie.driver", "./Drivers/IEDriverServer.exe");

//For Firefox Browser
System.setProperty("webdriver.gecko.driver", "./Drivers/geckodriver.exe");

It’s a good practice to maintain driver executables under project directory as shown below.

Now let us see the disadvantages of following traditional approach over WebDriverManager to maintain driver executables and setting path for the same.

1. We need to download driver executables manually and set path for the same.

2. As and when browser version is updated, we need to download driver executable/s that can be matched with latest browser version.

3. We need to set exact path for driver executable/s else we get illegalStateException. [When we try to launch browser without setting correct path for driver executable/s]

Now the question is how can we overcome doing above manual stuff using WebDriverManager.


Project should be Maven. In pom.xml file we need to add below dependency to have WebDriverManager in our Project.


Once WebDriverManager is added into pom.xml. Update Maven Project and ensure that WebDriverManager Jar is added into Project Build Path under Project Maven Dependencies folder as shown below.


Notice that simply adding WebDriverManager.chromedriver().setup(); 

WebDriverManager does magic for you:

  1. It checks the version of the browser installed in your machine (e.g. Chrome, Firefox).
  2. It checks the version of the driver (e.g. chromedrivergeckodriver). If unknown, it uses the latest version of the driver.
  3. It downloads the WebDriver binary if it is not present on the WebDriverManager cache (~/.m2/repository/webdriver by default).
  4. It exports the proper WebDriver Java environment variables required by Selenium (not done when using WebDriverManager from the CLI or as a Server).

WebDriverManager resolves the driver binaries for the browsers ChromeFirefoxEdgeOperaPhantomJSInternet Explorer, and Chromium. For that, it provides several drivers managers for these browsers. These drivers managers can be used as follows:




Now we are good to use WebDriverManager in Test Scripts.

//For Chrome Browser

//For Internet Explorer Browser

//For Firefox Browser

Likewise we can setup driver executables for other browsers like edge, opera etc using WebDriverManager which launches a browser.

//Below is the sample code to launch Chrome Browser using WebDriverManager
public class WebDriverManagerChrome 
	public void webDriverManagerChrome()
		WebDriver driver = new ChromeDriver();
		driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
		driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);

When we setup WebDriverManager in Project. By default, it downloads the latest version for a specified driver executable/s. Using WebDriverManager, we can also setup driver executable/s for a specific browser version.

//Code Snippet for Chrome Browser

Now let us see the difference between WebDriverManager and Traditional way of setting up driver executables to launch browsers.

WebDriverManager.chromedriver().setup(); ==>> It will automatically downloads the Driver Executable/s.

System.setProperty(“webdriver.chrome.driver”, “./Drivers/chromedriver.exe”); This will setup driver executable for a specific browser based on the location that we have provided where we downloaded and placed driver executable/s.

Note: WebDriverManager is not part of Selenium WebDriver API.

Refer below Git Repository for WebDriverManager implementation with Maven Project.


In this blog, we have seen setting up WebDriverManager for a Maven Project to work with Selenium WebDriver API.



Naveen AutomationLabs

Blog Contributors:

Author:  Pavan K

Pavan, having good knowledge in Selenium Web UI and API Automation frameworks. Also, he is helping QA community with his knowledge along with Naveen AutomationLabs!!


Reviewer: Naveen Khunteta