Getting started with WDM(WebDriverManager)

Arvind Choudhary
2 min readApr 17, 2022

Hello Readers,

Whenever we talk about Automation Testing(Browser Automation) we should have a few things in place:

  1. Browser (Should be on the system path).
  2. Driver Executable (Should be on the system path), Driver Executable version should be the same as Browser Version.
  3. Automation Library(In our case Selenium).

The second part of Point 2 is tedious. Nowadays we get at least one browser update every month or two, so we have to download the driver executable which is released for that particular browser version.

Chrome update release list : https://en.wikipedia.org/wiki/Google_Chrome_version_history
source: Google Chrome version history — Wikipedia

As shown in fig, chrome releases multiple browsers update each month in stable/beta/developer channels.

So, How can we make our test project so that there should be no manual intervention required in getting the correct driver executables for different browsers?

WDM(WebDriverManager) utility which is created by bonigarcia (Boni García) (github.com).

WebDriverManger
WebDrverManager icon

WebDriverManager

WebDriverManager is an open-source Java library that 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. In addition, as of version 5, WebDriverManager provides other relevant features, such as the capability to discover browsers installed in the local system, building WebDriver objects (such as ChromeDriver, FirefoxDriver, EdgeDriver, etc.), and running browsers in Docker containers seamlessly.

Maven dependency:

<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.1.1</version>
</dependency>

Pom.xml:

minimal pom.xml dependency list for browser automation with WDM and selenium.

pom.xml dependency list
pom.xml

Script (java):

I’ve used java language to use with selenium.

BrowserAutomation.java class
BrowserAutomation.java

Examples of how to set up driver executable for different browsers.

WebDriverManager.chromedriver().setup();

WebDriverManager.edgedriver().setup();

WebDriverManager.firefoxdriver().setup();

How to specify which driver executable we want (Explicit specification, Optional)

WebDriverManager.firefoxdriver().browserVersion("100").setup();

Console print:

Console print

Useful URL's

  1. bonigarcia (Boni García) (github.com) — github page of creator
  2. WebDriverManager (bonigarcia.dev) — webdrivermanager site
  3. bonigarcia/webdrivermanager: Automated driver management and Docker builder for Selenium WebDriver (github.com) — WebDriverManger repository.

Thank you for staying along with me!

--

--