【问题标题】:Error when running cucumberjs ft. selenium, phantomjs, webdriverio运行 cucumberjs ft. selenium、phantomjs、webdriverio 时出错
【发布时间】:2016-03-01 11:35:48
【问题描述】:

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

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

像这样为 cucumberjs 正确配置 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:\Program Files (x86)\nodejs\phantomjs”(在目录“.”中): CreateProcess 错误=193,%1 不是有效的 Win32 应用程序)

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

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

【问题讨论】:

    标签: node.js selenium phantomjs cucumberjs webdriver-io


    【解决方案1】:

    嗯,终于在这个类似的github issue找到了原因。

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

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

    【讨论】:

      猜你喜欢
      • 2013-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-27
      • 2018-01-30
      • 1970-01-01
      相关资源
      最近更新 更多