I came to know recently that using 'WebDriver Binaries' manager is a good practice in Automation projects. But not sure what is this and how to use? Did some google searches also and got quite a lot posts around how to manage binaries; but not on why to use. So it will be great if someone can guide on it with its benefits.
-
Did you use selenium in your automation project, or using other automation tool? If you use selenium, you can't avoid to use `WebDriver binary` only except you use earlier version of selenium and Firefox ( For earlier selenium and firefox, the webdriver for firefox is an extension and integrated into selenium jar, the extension will be installed into firefox automatically by selenium) – yong Nov 13 '18 at 07:55
-
Can you share code example of how you're using Selenium without WebDriver? – Andersson Nov 13 '18 at 08:23
-
HI Yong and Andersson: I'm using webDriver only but not sure/aware of term 'Binary'..may be question needs to be reformed I've edited it..:( – saTya Nov 13 '18 at 10:43
-
1binary = binary executable file such as chromedriver or geckodriver – Corey Goldberg Nov 13 '18 at 22:47
2 Answers
Finally Got to know about it some time back as below, thought it might be useful for other hence posting it as self Answer.
As an automation engineer, we always have to set the path for the browser binary, for this first, we need to download a binary file[driver.exe] which allows WebDriver to handle browsers. In addition, the absolute path to this binary must be set as JVM properties, as follows:
System.setProperty("webdriver.chrome.driver", "Your path to/chromedriver"); System.setProperty("webdriver.gecko.driver", "Your path/geckodriver");
Its just not about the downloading and setting properties to set the binary path but you also need to change the binaries frequently as the browser version or Selenium version changes. I found this solution and implemented it- and That's All! Now I don't need exe libraries anymore for the browsers! A small maven repository made life easy.
How it works: When 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 just need to add the following dependency in your pom.xml:
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.3.0</version>
</dependency>
WebDriverManager actually gets your browser version and downloads the compatible browser binary by itself to make you run your code without interruption.
Now, rather than setting the browser binaries, you just need to add below line of code in your browser manager class and that's it.
WebDriverManager.chromedriver().setup(); driver = new ChromeDriver();
You're done!
The line WebDriverManager.chromedriver().setup()
, does all 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.
Reference: https://github.com/bonigarcia/webdrivermanager#webdrivermanager-as-java-dependency

- 305
- 1
- 5
- 15
When you say WebDriver binaries, I am assuming that you are talking about the WebDriver bindings or the libraries. With out adding the WebDriver binding's into your project you can't really do anything with the WebDriver interface, like you can't invoke any browser or drive any website. Either you can manually add them into your project build path or you can use any dependency management tool like Maven for getting all the WebDriver libraries into your project. You can then use them. You can either just add the standalone server file, which would do the same job as WebdDriver bindings.
There are Third Party Driver's which we use for each of the bowser's like, chrome - chromedriver.exe, firefox - geckodriver.exe ..etc ---These are also called as WebDriver binarie's(mostly refereed as driver files).

- 140
- 11