When I executing the following code:
public static void main(String[] args) {
try {
FirefoxDriver driver = new FirefoxDriver();
driver.get("http:www.yahoo.com");
} catch (NoClassDefFoundError ex) {
System.out.println("error: " + ex.getStackTrace());
}
}
I'm facing the following error:
error:[Ljava.lang.StackTraceElement;@80f4cb
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function
Could someone help me to find the solution or reason for this?
After you extract your "selenium-java-.zip" file you need to configure your build path from your IDE. Import all the jar files under "lib" folder and both selenium standalone server & Selenium java version jar files.
Please include all the jar files of selenium stand-alone and lib folder, then this error will resolved
I wanted to try a simple class outside IDE and stuff. So downloaded selenium zip from website and run the class like this:
I had the issue that I initially used
lib
instead oflibs
. I didn't need to add selenium standalone jar. This is Java 8 that understands wildcards in classpath. I think java 7 would also do.