问题
I'm working with Selenium 2 WebDriver
in Eclipse and everything works fine.
But when I want to test my WebDriver Testcases without Eclipse many missing classes occur.
First it startet with :
NoClassDefFoundError com/google/common/collect/Maps
so I downloaded the guava.jar and set the classpath to it.
But now the next NoClassDefFoundError occured:
java.lang.NoClassDefFoundError: org/json/JSONException
The errors always occur on createDriver();
I run the Selenium with JUnit in Java.
"JUnit only"-testcases work fine (set the classpath to junit.jar & selenium-java.jar)
Do you know which jars I have to bind in that eclipse already has bound in as default for the selenium testcases?
回答1:
Are you using a standalone server download?
If you download the selenium server package you'll get about 47 jars with it. I believe you need all of those jars in your classpath in order to execute. That package can be downloaded from here
Or the standalone package can be downloaded from http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.20.0.jar
If you're not using it right now, the easiest solution might be to switch to the standalone version; otherwise download the full server & add all the jars to your classpath.
来源:https://stackoverflow.com/questions/9699997/selenium-2-webdriver-noclassdeffounderrors