Last active
January 17, 2023 19:47
-
-
Save nadvolod/286c9d88fed836547367453d5ffa0781 to your computer and use it in GitHub Desktop.
How to use WebDriverManager with Junit 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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