I have a spring boot application, that I want to test with Selenium. I'm using WebDriverManager v5.0.3
When settin up the WebDriver WebDriverManager.chromedriver().setup();
I get an exception:
java.lang.NoClassDefFoundError: org/openqa/selenium/internal/Require
or
java.lang.ClassNotFoundException: org.openqa.selenium.internal.FindsById
My pom.xml contains this:
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>4.1.0</version>
</dependency>
There is an incompatibility between WebDriverManager v5.0.3 and Selenium v4. After Downgrading Selenium to the latest v3 subversion, everything works.
Update: As of the comment below it works with WebDriverManager >=v5.1.0
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.141.59</version>
</dependency>