运行cucumberjs ft。selenium,phantomjs,webdriverio时出错
我已经在全球安装了phantomjs npm install -g phantomjs
用java -jar selenium-standalone-2.52.0.jar
启动selenium
像这样正确configurationcucumber的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一起工作,但幻灯片失败。
这是我从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
存在。
我错过幻影/selenium的任何configuration?
那么,最后我find了这个类似github问题的原因。
C:\Program Files (x86)\nodejs\phantomjs
只适用于Linux系统。 看起来phantomjs的webdriver没有检查在窗口应用程序上运行的情况。
为了快速解决问题,我删除了文件C:\Program Files (x86)\nodejs\phantomjs
,所以selenium会自动调用phantomjs.bat在同一个文件夹上。 一切都会正常工作。