This repository contains JUnit examples to automate the Selenium Webdriver binaries management using WebDriverManager. These examples are open source, released under the terms of Apache 2.0 License.
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>2.2.4</version>
</dependency>Then you can let WebDriverManager to do manage WebDriver binaries for your application/test. For example, as a JUnit test using Chrome browser:
public class ChromeTest {
private WebDriver driver;
@BeforeClass
public static void setupClass() {
WebDriverManager.chromedriver().setup();
}
@Before
public void setupTest() {
driver = new ChromeDriver();
}
@After
public void teardown() {
if (driver != null) {
driver.quit();
}
}
@Test
public void test() {
// Your test code here
}
}... and using Firefox:
public class FirefoxTest {
private WebDriver driver;
@BeforeClass
public static void setupClass() {
WebDriverManager.firefoxdriver().setup();
}
@Before
public void setupTest() {
driver = new FirefoxDriver();
}
@After
public void teardown() {
if (driver != null) {
driver.quit();
}
}
@Test
public void test() {
// Your test code here
}
}WebDriverManager-Examples (Copyright © 2016-2018) is a personal project of Boni Garcia licensed under Apache 2.0 License. Comments, questions and suggestions are always very welcome!
