Binary location error while testing with Firefox

86 Views Asked by At

I have this github.js file with some tests:

module.exports = {
    const homeToLoginPage = () => {
      client
      .url(homeURL)
      ...
    };

    const incorrectLoginFlow = () => {
      client
      .waitForElementVisible(selectors.loginInputField, timeout)
      ...
    };

    homeToLoginPage();
    incorrectLoginFlow();
  }
}

When I run it with Google Chrome npm test -- -t tests/github.js everything is ok, but when I try to run it with Firefox npm test -- -t tests/github.js --env firefox I get this error message: "Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line".

I have checked that firefox.exe is located there: C:\Program Files\Mozilla Firefox which should be default for Windows.

Also there is related night.conf.js file:

module.exports = {
  src_folders: ['tests'],
  webdriver: {
      start_process: true,
      port: 4444
  },
  test_settings: {
      default: {
          desiredCapabilities: {
              browserName: 'chrome'
          },
          webdriver: { server_path: require('chromedriver').path },
          
          'screenshots': {
            'enabled': true,
            'on_failure': true,
            'path': './screens'
          },

          'test_workers': {
            'enabled': false,
            'workers': 'auto'
          },
      },
      firefox: {
          desiredCapabilities: {
              browserName: 'firefox'
          },
          webdriver: { server_path: require('geckodriver').path }
      }
  }
}; 

I searched a lot and found that someone tries to change some Firefox capabilities in moz:firefoxOptions to note tha path to firefox.exe manually but I can't find where I can do it. Please give some advice how to run the test in Firefox browser.

1

There are 1 best solutions below

0
Ilya On

Found this solution: added values into system variable PATH. Firefox default folder and geckodriver folder as well were added to PATH.

Folders added to PATH