Selenium 2 WebDriver NoClassDefFoundErrorS [英] Selenium 2 WebDriver NoClassDefFoundErrorS

查看:207
本文介绍了Selenium 2 WebDriver NoClassDefFoundErrorS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Eclipse中使用 Selenium 2 WebDriver ,一切正常。



但是当我想要在没有Eclipse的情况下测试我的WebDriver TestCases许多缺少的类都会发生。



首先尝试:

  NoClassDefFoundError com / google / common / collect / Maps 

所以我下载了番石榴.jar并设置类路径。



但是现在下一个NoClassDefFoundError发生了:

 code> java.lang.NoClassDefFoundError:org / json / JSONException 

错误总是发生在我在Java中使用JUnit运行Selenium。


$



b $ b

JUnit only-testcases工作正常(将classpath设置为junit.jar& selenium-java.jar)



你知道哪个jar我必须绑定在那个eclipse已经绑定为selenium测试用例的默认值?

解决方案

您是否使用独立的服务器下载?



如果您下载selenium服务器软件包,您将获得约47个jar。我相信你需要你的类路径中的所有这些jar来执行。该软件包可以从这里



或者可以从 http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone -2.20.0.jar



如果您现在不使用它,最简单的解决方案可能是切换到独立版本;否则下载完整的服务器&将所有罐子添加到您的类路径。


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?

解决方案

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.

这篇关于Selenium 2 WebDriver NoClassDefFoundErrorS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆