2

我正在使用Conductor框架运行我的测试,并且我想使用 PhantomJS 运行测试。尽管 PhantomJS 安装在预期的目录中,但 Conductor 抱怨它不是。

我的测试中的 JUnit 配置:

@Config(browser = Browser.PHANTOMJS, url = "http://url")

日志输出:

      Nov 23, 2015 10:58:32 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: executable: /Users/richhunt/IdeaProjects/selenium/phantomjs
Nov 23, 2015 10:58:32 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: port: 48487
Nov 23, 2015 10:58:32 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: arguments: [--webdriver=48487, --webdriver-logfile=/Users/richhunt/IdeaProjects/selenium/phantomjsdriver.log]
Nov 23, 2015 10:58:32 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: environment: {}
2015-11-23 10:58:52 [main] FATAL Locomotive:705 - phantomjs not found. Download them from https://bitbucket.org/ariya/phantomjs/downloads/ and extract the binary as phantomjs.exe, phantomjs.linux, or phantomjs.mac at project root for Windows, Linux, or MacOS.

Process finished with exit code 1
4

1 回答 1

1

您可能没有实际安装 PhantomJS?从头开始,我进行了测试,并遇到了同样的问题。然后我跑了:

npm install -g webdriverjs phantomjs

并重新运行相同的测试,它按预期工作。

这是我使用的测试:

@Config(browser = Browser.PHANTOMJS, url = "http://google.com")
public class PhantomJSTest extends Locomotive {
    @Test
    public void testPhantomJSWorks() {
        setText("[name='q']", "Test");
    }
}
于 2015-11-23T18:33:13.513 回答