Selenium 2 WebDriver NoClassDefFoundErrorS

丶灬走出姿态 提交于 2019-12-21 20:54:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!