0

After the Firefox self-upgraded to version 47, Selenium stopped working. I followed the Javascript (Node.js) steps suggested by Mozilla regarding the Marionette driver, but the console says that it can't find Firefox on my current system, however the path to the browser is fine and standard. The error is "Could not locate Firefox on the current system" at C:\Users\\node_modules\selenium-webdriver\firefox\binary.js:115:11

If it matters, I use WebdriverJS.

Mike Trent
  • 23
  • 1
  • 5

6 Answers6

0

I've had this happen and it always seems to be very random. This is a long shot but try changing the path and then putting the original back this has worked for me in the past.

0

I'm having a similar problem and see that there seem to be a wealth of problems with Firefox 47 and WebDriver (JS and other languages) being discussed in the GG group. Your only solution for now might be to downgrade - https://ftp.mozilla.org/pub/firefox/releases/46.0.1/

Admittedly, downgrading did not solve my problem, but ymmv

Frank
  • 899
  • 1
  • 8
  • 13
0

I had the same problem and solved it by downloading the Developer Edition from https://www.mozilla.org/en-US/firefox/developer/. Apparently there is some conflict regarding using the developer edition of firefox.
In node_modules/selenium-webdriver/firefox/binary.js, line 99, this code :

let exe = opt_dev
        ? '/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox-bin'
        : '/Applications/Firefox.app/Contents/MacOS/firefox-bin';
    found = io.exists(exe).then(exists => exists ? exe : null);

chose the DeveloperEdition, but I didn't have it, which caused found to be null and later an error is thrown in line 115.

Achi Even-dar
  • 427
  • 1
  • 10
  • 20
0

Could it be that your Firefox is not installed in the default location? Mine is installed in C:\Users\(username)\AppData\Local\Mozilla Firefox\, and I get the same error message as you.

Browsing the code (thanks @achie), I found the following in node_modules\selenium-webdriver\firefox\index.js:

* On Windows and OSX, the FirefoxDriver will search for Firefox in its
* default installation location:
*
* * Windows: C:\Program Files and C:\Program Files (x86).
* * Mac OS X: /Applications/Firefox.app
*
* For Linux, Firefox will be located on the PATH: `$(where firefox)`.

In other words, it's not even any use to put the Firefox directory in the PATH variable on Windows.

But the source code continues:

* You can configure WebDriver to start use a custom Firefox installation with
* the {@link Binary} class:
*
*     var firefox = require('selenium-webdriver/firefox');
*     var binary = new firefox.Binary('/my/firefox/install/dir/firefox-bin');
*     var options = new firefox.Options().setBinary(binary);
*     var driver = new firefox.Driver(options);

In my case, that becomes:

var firefox = require('selenium-webdriver/firefox');
var binary = new firefox.Binary('C:\\Users\\(username)\\AppData\\Local\\Mozilla Firefox\\firefox.exe');
var options = new firefox.Options().setBinary(binary);
var driver = new firefox.Driver(options);

Now Selenium finds my Firefox, but I get a next error message:

Error: Timed out waiting for the WebDriver server at http://127.0.0.1:53785/hub

I also tried var driver = new webdriver.Builder().forBrowser('firefox').setFirefoxOptions(options).build();, but that didn't make any difference.

Hope this helps you a bit further!

Peter
  • 2,874
  • 2
  • 31
  • 42
0

The folks at Mozilla are recommending using the Marionette driver as there is a start up crash issue with Selenium Webdriver 2.53 and Firefox 47/48

https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver

RaimondW
  • 13
  • 3
0

The latest Firefox 48 and Selenium Webdriver 3.0.0 solved this particular issue.

Mike Trent
  • 23
  • 1
  • 5