0

I am getting an error "Exception in thread "main" java.lang.NoClassDefFoundError", when running a small selenium.

Added external jar file is client-combined-3.141.59.jar

If adding some more jar files like selenium-server-standalone-3.141.59, okio-1.14.1.jar errors are increasing.

package seleniumBasic;

import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver;

public class selenium {

public static void main(String[] args) {

    WebDriver driver = new FirefoxDriver();
    driver.get("https://www.facebook.com/");
    driver.manage().window().maximize();

}
0

1 Answer 1

0

Probably you did not add the library correctly to your build path. From where did you get that jar and how did you add it to your project?

Anyway, I would suggest to use gradle to add these libraries. Just add the gradle nature to your project and use following example build.gradle file:

plugins {
    id 'java-library'
}

dependencies {
    implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59'
}

repositories {
    jcenter()
}
Sign up to request clarification or add additional context in comments.

1 Comment

I downloaded jars from seleniumhq website and added using build path provided in java. I am a beginner trying to learn selenium by myself.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.