java.lang.NoClassDefFoundError: org/openqa/selenium/HasAuthentication Issue

478 views
Skip to first unread message

Asini Hemarathne

unread,
Aug 26, 2024, 1:45:28 AM8/26/24
to Selenium Users
Hi all, 

I keep getting java.lang.NoClassDefFoundError: org/openqa/selenium/HasAuthentication error when I'm trying to run some basic tests. 

The selenium dependencies I have used are,

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>4.16.1</version>
</dependency>

<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.3.1</version>
</dependency>

The webdriver initialization code is as follows;

public static WebDriver initializeDriver() {
        WebDriverManager.chromedriver().setup();
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--headless=new");
        WebDriver driver=new ChromeDriver(options);
        return driver;
    }

Can please clarify me why I keep getting this error with my setup or I'm missing some other dependencies?

Thanks and regards,
Asini




SiKing

unread,
Aug 26, 2024, 1:16:27 PM8/26/24
to Selenium Users
You need to have artifactId=selenium-java.
Also, if you use the latest Selenium, you do not need an explicit dependency on webdrivermanager; it is included.

Andrei Solntsev

unread,
Aug 26, 2024, 3:11:15 PM8/26/24
to seleniu...@googlegroups.com
Hi Asini,
WebDriverManager transitively brings an old version of some of "selenium-*.jar"s. 


P.S. As mentioned before, most probably you should remove "webdrivermanager" dependency. 

Andrei Solntsev


пн, 26 авг. 2024 г. в 20:17, SiKing <mark....@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3ff28481-6957-4997-b8c1-4b66ccd2c4e1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages