Node.js 运行cucumberjs ft.selenium、phantomjs、WebDrivero时出错

Node.js 运行cucumberjs ft.selenium、phantomjs、WebDrivero时出错,node.js,selenium,phantomjs,cucumberjs,webdriver-io,Node.js,Selenium,Phantomjs,Cucumberjs,Webdriver Io,我已经全局安装了phantomjsnpm安装-g phantomjs 使用java-jar selenium-standalone-2.52.0.jar启动selenium 为CucumberJ正确配置World对象,如下所示: var options = { //desiredCapabilities: { browserName: 'internet explorer' }, // WORK //desiredCapabilities: { browserName: 'chr

我已经全局安装了phantomjs
npm安装-g phantomjs

使用
java-jar selenium-standalone-2.52.0.jar启动selenium

为CucumberJ正确配置
World
对象,如下所示:

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上工作,但在phantomjs上失败了

这是我从Selenium控制台得到的错误:

错误-org.apache.commons.exec.ExecuteException:执行失败 (退出值:-559038737.由java.io.IOException引起:无法运行 程序“C:\ProgramFiles(x86)\nodejs\phantomjs”(在目录“.”中): CreateProcess错误=193,%1不是有效的Win32应用程序)

C:\ProgramFiles(x86)\nodejs\phantomjs
存在


我是否错过了phantom/selenium的任何配置?

好吧,最后我在类似的例子中找到了原因

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

为了快速解决这个问题,我删除了文件
C:\ProgramFiles(x86)\nodejs\phantomjs
,因此selenium将自动调用同一文件夹中的phantomjs.bat。一切都会好起来的