using WebDriverManager class in Selenium WebDriver



Selenium WebDriver automation tool is mainly useful to run tests against multiple Browsers such as Chrome Browser,Firefox Browser,Internet Explorer Driver.Running the tests against multiple browsers is known as Cross Browser Testing.
To launch the Browser in Selenium WebDriver we need to set the path of the executable available in the laptop. Following that we have to instantiate the driver instance based on the Driver instance. In order to avoid these steps we can use the WebDriverManager class.

WebDriverManager

WebDriverManager allows to automate the management of the binary drivers (e.g. chromedriver, geckodriver, etc.) required by Selenium WebDriver.
Using WebDriverManager its not required to maintain the below lines of the code for launching the browser.
System.setProperty(“webdriver.chrome.driver”, “/path/to/binary/chromedriver”);
System.setProperty(“webdriver.gecko.driver”, “/path/to/binary/geckodriver”);
System.setProperty(“webdriver.opera.driver”, “/path/to/binary/operadriver”);
System.setProperty(“phantomjs.binary.path”, “/path/to/binary/phantomjs”);
System.setProperty(“webdriver.edge.driver”, “C:/path/to/binary/MicrosoftWebDriver.exe”);
System.setProperty(“webdriver.ie.driver”, “C:/path/to/binary/IEDriverServer.exe”);

WebDriverManager Maven Depdendency

To use the WebDriverManager class ensure the following depedency is added in the maven project object model (pom.xml) file.


Like our Facebook Page to get frequent updates->

https://www.facebook.com/totalqa


Selenium WebDriver Code

Execute the below code in eclipse and verify the results.

Leave a Reply

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