Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to use WebDriverManager with Junit 4
import io.github.bonigarcia.wdm.WebDriverManager;
//This method will run once before all of the tests in our class
@BeforeClass
public static void setupClass() {
WebDriverManager.chromedriver().setup();
}
//The setup() will run one time before every single @Test method
//In our case it will instantiate a new ChromeDriver that WebDriverManager setup for us
@Before
public void setup()
{
driver = new ChromeDriver();
}
//You need to add WebDriverManager dependency to your POM.xml
// https://github.com/bonigarcia/webdrivermanager/
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>4.0.0</version>
<scope>test</scope>
</dependency>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.