Automation of web driver | Usage of WebDriverManager or alternative for System.setProperty("", "D\chromedriver.exe");

Sadakar Pochampalli
JasperSoft BI Suite Tutorials - Sadakar Pochampalli )

  • WebDriverManager is an open-source Java library
  • It carries out the management (i.e., download, setup, and maintenance) of the drivers required by Selenium WebDriver(e.g., chromedriver, geckodriver, msedgedriver, etc.) in a fully automated manner.
  • The primary use of WebDriverManager is the automation of driver.
  • With this we can get rid of System property to fetch the driver placed in physical drive or from the project path. 
More details :

GitHub @

This is how we set the path for chrome driver once the driver is downloaded and placed in system hard drive . 
System.setProperty("", "D\chromedriver.exe");

Now, using DriverMnager we can get rid of physical drive path, that is replace the above line of code with 

This requires the following dependency to be added in pom.xml file. 

<!-- -->

In the Before hook of cucumber, normally we create the ChromeDriver object, prior creating the chrome driver object, we need to call the chrome driver setup() as shown in below example.

@Before(order = 0) // Cucumber Before Hook with order 0
public void before(Scenario scenario) throws IOException {"Initiating the chrome driver from Cucumber Before hook with order=0");
driver = new ChromeDriver();