本文介绍了如何使用wdio testRunner和wdio-selenium-standalone-service在firefox上运行webdriverio测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的环境:

  1. Mac OSX 10.12.6
  2. webdriverio(使用测试运行程序,即wdio)("webdriverio": "^4.9.11")
  3. 黄瓜框架("wdio-cucumber-framework": "^1.0.3")
  4. 使用WDIO Selenium Standalone Service帮助自动启动硒服务.("wdio-selenium-standalone-service": "0.0.10")
  5. firefox(版本:52)
  1. Mac OSX 10.12.6
  2. webdriverio(using the test runner i.e., wdio)("webdriverio": "^4.9.11")
  3. Cucumber framework ("wdio-cucumber-framework": "^1.0.3")
  4. Using WDIO Selenium Standalone Service help to start the selenium service automatically.("wdio-selenium-standalone-service": "0.0.10")
  5. firefox(version: 52)

我能够在chrome浏览器(版本:65)上成功运行测试,但是当涉及到Firefox时,我总是会出现connection refused错误.

I am able to successfully run the tests on chrome browser(version: 65) but when it comes to firefox i always get connection refused error.

更多详细信息:

在wdio的配置文件中,我已经提到firefox作为browserName.一旦测试开始,firefox将启动,并停留在新选项卡"页面上.它不会导航到URL.

In the wdio config file i have mentioned firefox as browserName. Once the test is started firefox launches and it stays on the "New Tab" page. It does not navigate to the URL.

一段时间后(例如:60秒后),在wdio日志中,我可以看到ERROR: connection refused.此外,Firefox最终也不会退出.

After some time(like: 60 secs later), In the wdio logs i can see ERROR: connection refused. Additionally the firefox also does not quit in the end.

注意:如果将browserName更改为chrome,则相同的测试也可以正常工作.

NOTE: The same test works fine if change the browserName to chrome.

WDIO Config文件功能部分:

WDIO Config file capabilities part:

...capabilities: [{

    maxInstances: 5,
    //
    browserName: 'firefox',
    marionette: true,
}],...

推荐答案

经过研究,可以自己解决此问题.

Able to FIX the issue by myself after some research.

问题是版本不匹配.

geckoDriver版本是0.20.0,而我使用的Firefox版本是52.

The geckoDriver verison is 0.20.0 and the firefox version i was using is 52.

我将Firefox升级到了最新版本.即版本59,并且我能够成功运行测试.

I upgraded the firefox to latest. i.e., version 59 and i was able to successfully run the test.

根据版本0.19.0

Note that with geckodriver v0.19.0 the following versions are recommended:
Firefox 55.0 (and greater)
Selenium 3.5 (and greater)

所以我知道更高版本也应该具有相同的属性.

So i understood that the higher version also should have the same property.

这篇关于如何使用wdio testRunner和wdio-selenium-standalone-service在firefox上运行webdriverio测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 14:27