In order to simplify the use of Selenium WebDriver in JUnit 5, the open source JUnit 5 extension called selenium-jupiter can be used. This extension has been built using the dependency injection capability provided by the extension model of JUnit 5. Thanks to this feature, different types objects can be injected in JUnit 5 in @Test methods as parameters. Concretely, selenium-jupiter allows to inject subtypes of the WebDriver interface (for example, ChromeDriver, FirefoxDriver, and so on).
Using selenium-jupiter is very easy. First, we need to import the dependency in our project (typically as test dependency). In Maven, it is done as follows:
<dependency> <groupId>io.github.bonigarcia</groupId> <artifactId>selenium-jupiter</artifactId> ...