Bid Adieu – Browser Binaries

Bid Adieu – Browser Binaries

As an automation engineer, I believe you have always set the path for the browser binary. You will know that in order to use some browsers such as Chrome, Firefox, Opera, PhantomJS, Microsoft Edge, or Internet Explorer, first, you need to download a binary file that allows WebDriver to handle browsers. In addition, the absolute path to this binary must be set as JVM properties, as follows:

System.setProperty("", "path/to/chromedriver"); 
System.setProperty("webdriver.gecko.driver", "path/to/geckodriver"); 
System.setProperty("", "path/to/IEDriverServer.exe");

I believe it’s a bit annoying every time you need to set the binary path. Not just limited to this one, you also need to change the binaries frequently as browser version changes or sometimes Selenium version changes. I know to work with a client in one major long-term project client asked me why he needs to change the library and what if he doesn’t need to change those library and the script work as it is even he changed the browser versions. I was speechless that time but later doing R&D I found a lifesaver solution. I implemented that and bingo!
I don’t need exe libraries anymore for the browsers!!! A small maven repository saves the day.

As working on a Maven Project you just need to add a dependency called WebDriverManager. This library will take care of everything your browser version and driver.

In order to use WebDriverManager in a Maven project, you need to add the following dependency in your pom.xml (Java 7 or upper required):


WebDriver Manager actually gets your browser version and download the compatible browser binary by itself to make you run your code without interruption.

So now, rather than setting the browser binaries, you just need to add below line of code and you’re done.

driver = new ChromeDriver();

The line WebDriverManager.chromedriver().setup(); WebDriverManager does magic for you:

It checks for the latest version of the WebDriver binary.
It downloads the WebDriver binary if it’s not present on your system.
It exports the required WebDriver Java environment variables needed by Selenium.

For each and every browser you can add setup the particular WebDriverManager instance.

  1. Also, certain benefits of the WebDrivers are :
  2. You can also search for the particular binary version as well in the WebDriverManager. By default, it’ll download the latest binary version.
  3. You can also set the path for the downloaded binary files if in case of future use.
  4. By default, WebDriverManager connects to the specific driver repository URL to find out what is the latest version of the binary. This can be avoided by forcing to use of the latest version from the local repository.
  5. By default, WebDriverManager finds out the latest version of the binary, and then it uses the cached version if exists. This option forces you to download again the binary even if it has been previously cached.
  6. By default, WebDriverManager skips beta versions. With this method, WebDriverManager will download also beta versions.
  7. By default, WebDriverManager would try to use the proper binary for the platform running the test case (i.e. 32-bit or 64-bit). This behaviour can be changed by forcing a given architecture: 32-bits (Architecture.x32) or 64-bits (Architecture.x64);

So now the struggle for the checking compatible binaries end, you can certainly enjoy the hassle-free automation and can make the client happy

Get Demo Code from here – WebDriverManagerDemo

#HappyTesting #QACaffe

Rahul R