本文介绍了在Windows 7上获取硒,ghostdriver,phantomJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用selenium-2.34和phantomJS-1.9.1-windows

I am using selenium-2.34 and phantomJS-1.9.1-windows

但是当我尝试使用时:

import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.phantomjs.PhantomJSDriverService;

我可以看到它没有检测到

I can see that it does not detect

org.openqa.selenium.phantomjs

遇到此错误

The import org.openqa.selenium.phantomjs cannot be resolved

我的印象是GhostDriver嵌入在PhantomJS中- https://github.com/detro/ghostdriver

I was under the impression that GhostDriver was embedded in PhantomJS - https://github.com/detro/ghostdriver

有人知道我的设置有什么问题吗?

does anyone know what could be wrong with my setup?

这可能是由于路径问题引起的,我是否需要为硒提供某种方式来拾取硒 https://github.com/detro/ghostdriver/tree/master/binding/java/src/main/java/org /openqa/selenium/phantomjs

Could this be due to a path issue, do i need to supply some way for selenium to pick up these up https://github.com/detro/ghostdriver/tree/master/binding/java/src/main/java/org/openqa/selenium/phantomjs

推荐答案

只需在pom.xml中添加以下内容(如果使用了maven):

Just add following in your pom.xml (if maven used):

<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/

Or, if maven not used, grab JAR file from here: http://grepcode.com/snapshot/repo1.maven.org/maven2/com.github.detro.ghostdriver/phantomjsdriver/1.0.3/

这篇关于在Windows 7上获取硒,ghostdriver,phantomJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 21:49