What is WEBDRIVERMANAGER In SELENIUM Web Driver

WebDriverManager is an open-source library that is used to automate the handling of browser driver binaries. Users can add this library to their selenium project using a build tool like Maven

Why we are using WebDriverManager?

To run the selenium script in the browser we need to download the driver binary from the official site of the Browser. This could be ‘chromedriver.exe’ for Chrome and ‘geckodriver.exe’ and similarly, we have many of the driver binary which need to be downloaded to run the script in any of the browsers.
But we are not stopping here and our problem is not resolved. But we need to add two lines of code

instead of System.setProperties(“webdriver.chrome.driver”, “path of the driver executable file”), which we need to manually add the browser driver each time for each version of the browser, here we can automatically download the driver executables by using webdrivermanager

Before adding the script, we need to add the WebDrivermanager dependency to the pom.xml from Maven Repository

WebDriverManger.Chromedriver.setup();

By executing the code the Webdriver manager checks the browser you are using and automatically downloads the driver executable files so you don’t need to download and set paths for drivers each time for each browser to successfully execute the script

Also, we can add a specific version of the browser driver by mentioning the version name -> WebDriverManager.chromedriver().driverVersion(“86.0.4240.22”).setup();

Attaching the video of successfully executing the script using WebDriverManager

Leave a comment

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