Running Selenium WebDriver without using EXE files

In order to run Selenium WebDriver on Chrome, Firefox, IE etc browser we need to set exe binary file path like below before initiate drivers.

System.setProperty("webdriver.chrome.driver", "/absolutepathtobinarychromedriver");
System.setProperty("webdriver.gecko.driver", "/absolutepathtobinarygeckodriver");

If you forgot to set path to the driver executable file using System.setProperty then illegal state exception will occur.

To avoid this we can use WebDriverManager in Maven project, you need to add the following dependency in your pom.xml file.

<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>3.0.0</version>
    <scope>test</scope>
</dependency>

and in Gradle project

dependencies {
    testCompile("io.github.bonigarcia:webdrivermanager:3.0.0")
}


WebDriverManager resolves the driver binaries for the browsers Chrome, Firefox  Internet Explorer etc. For that, it provides several drivers managers for these browsers. These drivers managers can be used as follows:

WebDriverManager.chromedriver().setup();
WebDriverManager.firefoxdriver().setup();
WebDriverManager.operadriver().setup();
WebDriverManager.phantomjs().setup();
WebDriverManager.edgedriver().setup();
WebDriverManager.iedriver().setup();

Refer below WebDriverManager Github link for more details and its methods
https://github.com/bonigarcia/webdrivermanager

Comments

Popular posts from this blog

Debugging in Protractor

Config file in Protractor

Handling Keyboard actions in Selenium