How to run webdriverio tests on firefox using wdio

2019-08-30 08:41发布

问题:

My environment:

  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)

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.

More details:

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.

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.

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

WDIO Config file capabilities part:

...capabilities: [{

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

回答1:

Able to FIX the issue by myself after some research.

The problem is version mismatch.

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

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

As per geckoDriver release notes of version 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.