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();

}

1 Answers1

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()
}
AndiCover
  • 1,724
  • 3
  • 17
  • 38
  • I downloaded jars from seleniumhq website and added using build path provided in java. I am a beginner trying to learn selenium by myself. – divya agnihotri Feb 24 '19 at 05:45