Firefox不会忽略黄瓜功能

时间:2016-10-17 17:17:16

标签: selenium webdriver selenium-firefoxdriver webdriver-io cucumberjs

我在firefox中运行Gherkin场景时遇到了很多麻烦。 该示例在Chrome中完美运行

我的wdio.conf.js中的功能

capabilities: [{
    // maxInstances can get overwritten per capability. So if you have an in-house Selenium
    // grid with only 5 firefox instance available you can make sure that not more than
    // 5 instance gets started at a time.
    maxInstances: 5,
    //
    browserName: 'firefox',
    path: '/usr/local/lib/node_modules/selenium-standalone/.selenium/selenium-server/3.0.0-beta3-server.jar'
  }],

我还使用firefox-profile和selenium-standalone服务器(wdio.conf.js中的服务)

services: ['selenium-standalone', 'firefox-profile'],
  firefoxProfile: {
    // extensions: ['/path/to/extensionA.xpi', '/path/to/extensionB.xpi'],
    'browser.startup.homepage': 'http://google.com',
    'plugin.state.npctrl': '2',
    'plugin.state.silverlight': '2'
  }

设定:

  • webdriverio:4.2.16
  • wdio-cucumber-framework:0.2.5
  • wdio-firefox-profile-service:0.0.1
  • wdio-selenium-standalone-service:0.0.7
  • cucumber(js):1.2.0
  • selenium-server:3.0.0-beta3
  • Firefox:49.0.1
  • geckodriver:0.10.0

Firefox打开并导航到google.com,但它没有运行测试,我得到以下输出:

=======================================================================================
Selenium 2.0 / webdriver protocol bindings implementation with helper commands in nodejs.
For a complete list of commands, visit http://webdriver.io/api.html.
=======================================================================================

[18:09:10]  COMMAND POST     "/wd/hub/session"
[18:09:10]  DATA        {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":5,"browserName":"firefox","path":"/usr/local/lib/node_modules/selenium-standalone/.selenium/selenium-server/3.0.0-beta3-server.jar","firefox_profile":"[base64] 1236 bytes","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.2.16","name":"webdriverio"}}}


0 passing (48.90s)

在Chrome中,相同的设置会获得(预期)以下输出:

=======================================================================================
Selenium 2.0 / webdriver protocol bindings implementation with helper commands in nodejs.
For a complete list of commands, visit http://webdriver.io/api.html.
=======================================================================================

[18:13:49]  COMMAND POST     "/wd/hub/session"
[18:13:49]  DATA        {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":5,"browserName":"chrome","path":"/usr/local/lib/node_modules/selenium-standalone/.selenium/selenium-server/3.0.0-beta3-server.jar","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.2.16","name":"webdriverio"}}}

(...)

6 passing (14.40s)

1 个答案:

答案 0 :(得分:0)

这可能是版本兼容性问题,降级到selenium服务器2.53.1,firefox升级到43.0使其运行完美。