phantomjs不适用于selenium java [英] phantomjs doesnt work with selenium java

查看:395
本文介绍了phantomjs不适用于selenium java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Selenium 2.44.0和PhantomJS 1.9.8.我的代码:

DesiredCapabilities c = new DesiredCapabilities();
c.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "<url to phantomjs.exe>");
WebDriver w = new PhantomJSDriver(c);

错误:

NoClassDefFoundError:org/openqa/selenium/browserlaunchers/代理

我该怎么办?

解决方案

硒2.44.0现在已经很老了(已经过时了.

但是,2.44.0/PhantomJS的不兼容性是有据可查的:

https://github.com/seleniumhq/selenium -google-code-issue-archive/issues/8088 https://github.com/detro/ghostdriver/issues/397

2.45.0中提供了解决方案,其中包含更新的PhantomJS驱动程序(即Selenium Java代码,无需更改应用程序.)

因此,您实际上所需要做的就是升级到2.45.0.

i am using Selenium 2.44.0 and PhantomJS 1.9.8. My code:

DesiredCapabilities c = new DesiredCapabilities();
c.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "<url to phantomjs.exe>");
WebDriver w = new PhantomJSDriver(c);

Error:

NoClassDefFoundError: org/openqa/selenium/browserlaunchers/Proxies

What should I do?

解决方案

Selenium 2.44.0 is pretty old now (October 2014), and PhantomJS 1.9.x is also pretty well obsolete.

However, the 2.44.0 / PhantomJS incompatibility is quite well documented:

https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/8088 https://github.com/detro/ghostdriver/issues/397

And the solution was provided in 2.45.0 with an updated PhantomJS driver (i.e. Selenium Java code, no change to the application).

So all you actually need to do is upgrade to 2.45.0.

这篇关于phantomjs不适用于selenium java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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