DEV Community

Arvind Choudhary
Arvind Choudhary

Posted on

3 2

Getting started with WDM(WebDriverManager)

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 release channel information - source: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 in such a way 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 could help us in automatically downloading driver version based on different browsers, browser version and OS's .


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>
Enter fullscreen mode Exit fullscreen mode

Pom.xml:

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

pom.xml

Script (java):

I’ve used java language to use with selenium.
script


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

bonigarcia's github page

WebDriverManager website

WebDriverManager repository

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay