7

When I run my Selenium tests with Firefox 28.0 I get:

"An exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll but was not handled in user code

Additional information: Unable to determine the current version of FireFox using the registry, please make sure you have installed FireFox correctly"

I successfully ran tests yesterday with Firefox.

I think Firefox auto-updated to 28.0 since yesterday.

Today I'm getting the above error.

I uninstall Firefox and reinstalled but I still get the same exception.

Selenium 2.40 Firefox 28.0 Gallio and MbUnit 3.4

Any ideas on how to fix? I suppose I could switch to IE for testing.

Ed

xpt
  • 20,363
  • 37
  • 127
  • 216
CoolBreeze
  • 381
  • 4
  • 14

3 Answers3

5

The error was generated on the call to FireFoxBinary() constructor.

 DriverObj = New FirefoxDriver(New FirefoxBinary(), New FirefoxProfile(), TimeSpan.FromMinutes(10))

The call to FirefoxBinary worked for three weeks so I'm not sure why it decided to fail yesterday. Perhaps it was the auto-update by Firefox from 27 to 28.

The solution was to add the file path to the Firefox binary:

 DriverObj = New FirefoxDriver(New FirefoxBinary("C:\Program Files (x86)\Mozilla Firefox\Firefox.exe"), New FirefoxProfile(), TimeSpan.FromMinutes(10))
CoolBreeze
  • 381
  • 4
  • 14
  • Where to do the change ? I have dlls. – mkkhedawat Dec 01 '14 at 09:24
  • Did you get where to include this. Facing same issue.. Pls help. – Hideandseek Dec 05 '15 at 07:01
  • When instantiating the `FirefoxDriver`, use an overload which takes a `FirefoxBinary` object. Set the `FirefoxBinary` constructor's argument to the full path and file of the Firefox Executable on your system. It is most likely to be located here: `c:\Program Files (x86)\Mozilla Firefox\firefox.exe`. – Zarepheth Jun 24 '16 at 14:39
1

One possible solution to this would be to manually add the registry key that is being searched for. Normal FireFox builds (non ESR) appear to place a key titled "CurrentVersion" with a string value of the version in the

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla FireFox

directory. Testing has shown me that when I place a key similar to this but with a string value of the ESR version installed on my system in this location Selenium will work. The caveat is that as this question is rather old I have tested with Selenium 3.0.1. If you would like to try this the your registry key should look like this without the quotes:

Name = "CurrentVersion" and 
Value = "45.6.0 ESR (x86 en-US)"

Please keep in mind that this solution will get you by in a pinch, but each time ESR updates you will need to go in and update the key value.

zx485
  • 28,498
  • 28
  • 50
  • 59
Isaiah Moran
  • 73
  • 1
  • 6
0

This was driving me mad, until i finally cracked it, here's the code that fixed mine:

        var options = new FirefoxOptions();
        options.BrowserExecutableLocation = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
        IWebDriver driver = new FirefoxDriver(options);
Mr Giggles
  • 2,483
  • 3
  • 22
  • 35