2016-03-01 17 views
1

我已经安装phantomjs全球npm install -g phantomjs错误运行cucumberjs英尺时硒,phantomjs,webdriverio

入门硒与java -jar selenium-standalone-2.52.0.jar

配置World对象cucumberjs正确这样的:

var options = { 
    //desiredCapabilities: { browserName: 'internet explorer' }, // WORK 
    //desiredCapabilities: { browserName: 'chrome' }, // WORK 
    desiredCapabilities: { browserName: 'phantomjs' }, // NOT WORK 
    waitforTimeout  : 2000, 
    host: '127.0.0.1', 
    port: 4444 
}; 

this.browser = webdriverio.remote(options); 

它与Chrome & IE一起工作,但幻灯片失败。

这是我从硒控制台得到了错误:

错误 - org.apache.commons.exec.ExecuteException:执行失败 (出口值:-559038737由java.io.IOException异常引起的。不能运行 程序 “C:\ Program Files文件(x86)的\的NodeJS \ phantomjs”(目录 “”): CreateProcess的错误= 193%1不是有效的Win32应用程序)

C:\Program Files (x86)\nodejs\phantomjs存在。

我是否错过幻像/硒的任何配置?

回答

1

那么,最后我找到了类似github issue的原因。

C:\Program Files (x86)\nodejs\phantomjs只适用于Linux系统。看起来phantomjs的webdriver没有检查在窗口应用程序上运行的情况。

为了快速解决问题,我删除了文件C:\Program Files (x86)\nodejs\phantomjs,这样硒会自动调用相同文件夹中的phantomjs.bat文件。一切都会正常工作。