csprv
csprv

Reputation: 59

Unable to instantiate Firefox using Marionette driver over Selenium and C#. os error

Could someone please help me with the following issue.

While I'm trying to initialize a browser I get the 'os error' exception.

var option = new FirefoxOptions();
option.IsMarionette = true;
var driver = new FirefoxDriver(option);

var b = new Browser(driver); // Throws an exception with a message - 'os error'

The screenshot of the exception

Plese note, the path to wires.exe is added to the system PATH. Selenium, wires, firefox are of the latest versions. I have tried running using firefox-stable and firefox-developer editions.

Thanks.

Upvotes: 3

Views: 1954

Answers (2)

Buster
Buster

Reputation: 715

So I ran into the 'os error' issue when I was trying to get Marionette working. The source of the issue in my case was I was trying to use some NuGet package called 'Mozilla Firefox Webdriver 0.6.0.1' which I believe had a very old version of the (now called) geckodriver.exe.

I downloaded the latest version of the driver from here https://github.com/mozilla/geckodriver/releases renamed to wires.exe and put in my working directory then I had to initiate the driver using the following code.

FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
Driver = new FirefoxDriver(service);

The way you initated the driver was giving me an entity not found exception.

Hope this helps

Upvotes: 2

unickq
unickq

Reputation: 3350

Maybe DesiredCapabilities would work.

   DesiredCapabilities capabilities = DesiredCapabilities.Firefox();
   capabilities.SetCapability("marionette", true);
   var driver = new FirefoxDriver(capabilities);

Upvotes: 0

Related Questions