2

我正在使用Selenium WebDriver在虚拟机上工作。我试图运行我的(再次,虚拟)工作在机器上测试,我发现了就行了NoClassDefFoundError的,我实例化我的司机:虚拟机上的selenium webdriver

driver = new FirefoxDriver(ffBinary,ffProfile); 

所以,是在虚拟机上,我做了一些研究,发现我可以使用RemoteWebDriver。试过这个之后,我仍然得到同样的错误。有什么建议么?我觉得这应该像在物理盒子上运行一样,但它不会。它在物理机器上完美运行。

堆栈跟踪:

java.lang.NoClassDefFoundError: com/google/common/io/Resources at org.openqa.selenium.firefox.FirefoxProfile.onlyOverrideThisIfYouKnowWhatYouAreDo‌​ing(FirefoxProfile.java:123) 
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:86) 
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:79) 
at line 63 in my class is where it breaks: File profile = new File(PROFILE); //PROFILE = where FF profile is (63) FirefoxProfile ffProfile = new FirefoxProfile(profile) 
+1

什么是完整的错误和堆栈跟踪创建配置文件? – Arran 2013-05-10 15:37:15

+0

'java.lang.NoClassDefFoundError:COM /谷歌/普通/ IO /资源 在org.openqa.selenium.firefox.FirefoxProfile.onlyOverrideThisIfYouKnowWhatYouAreDoing(FirefoxProfile.java:123) 在org.openqa.selenium.firefox.FirefoxProfile。 (FirefoxProfile.java:86) at org.openqa.selenium.firefox.FirefoxProfile。 (FirefoxProfile.java:79)' 在我班上的第63行是它破坏的地方: '文件配置文件=新文件(配置文件); // PROFILE =其中FF配置文件是 (63)FirefoxProfile ffProfile = new FirefoxProfile(配置文件)' – Brandon 2013-05-10 16:16:36

+0

检查您的类路径以查看该guvava库是否被正确定义。在代码中的命令行或sysout System.getproperty(“java.classpath”)中打印您的类路径。如果你正在使用Maven检查运行时依赖关系。 – 2013-05-10 16:42:21

回答