我正在使用 selenium-2.34 和 phantomJS-1.9.1-windows
但是当我尝试使用时:
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.phantomjs.PhantomJSDriverService;
我可以看到它没有检测到
org.openqa.selenium.phantomjs
遇到这个错误
The import org.openqa.selenium.phantomjs cannot be resolved
我的印象是 GhostDriver 嵌入了 PhantomJS - https://github.com/detro/ghostdriver
有谁知道我的设置有什么问题吗?
编辑:这可能是由于路径问题造成的,我是否需要提供一些方法让 selenium 拾取这些 https://github.com/detro/ghostdriver/tree/master/binding/java/src/main/java/org/openqa/selenium/phantomjs
最佳答案
只需在您的 pom.xml 中添加以下内容(如果使用 maven):
<dependency>
<groupId>com.github.detro.ghostdriver</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.0.3</version>
</dependency>
或者,如果不使用 maven,从这里获取 JAR 文件:http://grepcode.com/snapshot/repo1.maven.org/maven2/com.github.detro.ghostdriver/phantomjsdriver/1.0.3/
关于windows - 让 selenium、ghostdriver、phantomJS 在 Windows 7 上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18243309/