WebDriverManager - Solution to the selenium binaries


What is WebDriverManager ?

Problem: 

In order to use some browsers (for example Chrome,Internet ExplorerOperaMicrosoft EdgePhantomJS, or Marionette) you need to download a binary which allows WebDriver to handle the browser. In addition, the absolute path to this binary must be set as Java variables, as follows:
System.setProperty("webdriver.chrome.driver", "/absolute/path/to/binary/chromedriver");
System.setProperty("webdriver.opera.driver", "/absolute/path/to/binary/operadriver");
System.setProperty("webdriver.ie.driver", "C:/absolute/path/to/binary/IEDriverServer.exe");
System.setProperty("webdriver.edge.driver", "C:/absolute/path/to/binary/MicrosoftWebDriver.exe");
System.setProperty("phantomjs.binary.path", "/absolute/path/to/binary/phantomjs");
System.setProperty("webdriver.gecko.driver", "/absolute/path/to/binary/geckodriver");
Solution
This piece of software is a small library aimed to automate the Selenium Webdriver binaries management within a Java project in runtime.

What it does?

  1. It checks the latest version of the WebDriver binary file
  2. It downloads the binary WebDriver if it is not present in your system
  3. It exports the required Java variable by Selenium WebDriver

Usage
In order to use WebDriverManager in a Maven project, first add the following dependency to your pom.xml:
<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>1.4.6</version>
</dependency>
So far, WebDriverManager supports ChromeOperaInternet ExplorerMicrosoft EdgePhantomJS, or Marionette as follows:
ChromeDriverManager.getInstance().setup();
InternetExplorerDriverManager.getInstance().setup();
OperaDriverManager.getInstance().setup();
EdgeDriverManager.getInstance().setup();
PhantomJsDriverManager.getInstance().setup();
MarionetteDriverManager.getInstance().setup();


WebDriverManager (Copyright © 2015-2016) is a personal project of Boni Garcia licensed under LGPL License. Comments, questions and suggestions are always very welcome!
Source: https://github.com/bonigarcia/webdrivermanager

Comments

  1. Anonymous27/7/16

    #1.What are the advantages of this over traditional approach?

    #2. Will this works smoothly on grid?

    ReplyDelete
    Replies
    1. #1. The advantages, you don't have to worry what system you are working on , it downloads the appropriate jars. You also just have a single dependency and dont have to worry about the latest versions.
      #2 Yes it does , there is also a similar nuget version.

      Delete
  2. Thank you Ady..Your blog looks cool

    ReplyDelete
    Replies
    1. Thanks Vinod, Its a random testing blog like you would see :)

      Delete
  3. where is the grid setup?

    ReplyDelete
    Replies
    1. @Nikol - Docker with Grid should do the trick even if the code seems to work on the local JVM from where the getInstance().setup() is being called.

      Delete
  4. Anonymous19/8/16

    Why do you have to copy your content from the original website exactly as it is?

    https://github.com/bonigarcia/webdrivermanager

    ReplyDelete
    Replies
    1. If you would have noticed my blog is more of a what I learn over time. At the time that was a problem I was solving therefore the post

      Delete
  5. How to use this in eclipse?

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Where does the webdrivermanager nuget download the driver binary? I could not find the place where it downloads

    ReplyDelete
  8. Thanks for sharing, nice post! Post really provice useful information!

    An Thái Sơn chuyên võng điện máy đưa võng hay võng điện cho bé và chia sẻ kinh nghiệm giúp quý khách biết cục điện đưa võng giá bao nhiêu cũng như máy đưa võng loại nào tốt nhất cho giấc ngủ của bé.

    ReplyDelete
  9. I Like to add one more important thing here, Esoteric Testing Market by Technology (Mass Spectrometry, CLIA, ELISA, PCR), Type (Infectious Disease, Endocrinology, Oncology, Toxicology, Immunology, Neurology, Genetic Testing), Lab Type (Independent Labs, Hospital Laboratories), Region - Global Forecast to 2021-2026

    ReplyDelete

Post a Comment

Popular posts from this blog

Software Testing @ Microsoft

Trim / Remove spaces in Xpath?