Search code examples
c#seleniumfirefoxfirefox-marionette

c# Selenium 2.53 moving to marionette driver after firefox upgrade to 47


I am trying to move into the upgraded firefox web browser automation using selenium. It seems that selenium needs marionette driver to continue working. I followed the instructions set by the devs,

  1. downloaded the driver
  2. renamed it to wires.exe

The following code didnt manage to properly set the PATH to a custom path.

System.Environment.SetEnvironmentVariable("webdriver.gecko.driver", "@C:\DOWNLOADS\wires.exe")

so i added wires.exe to the debug\bin folder and then wires.exe worked properly but i got the following error

System.InvalidOperationException was caught Message=entity not found Source=WebDriver

this is the code i use to start webdriver

FirefoxOptions option1 = new FirefoxOptions();
option1.IsMarionette = true;
option1.AddAdditionalCapability("marionette", true);
driver = new FirefoxDriver(option1);

Solution

  • I too got the "Entity Not Found" error using FirefoxDriver(new FirefoxOptions()). It appears to be looking for firefox.exe in C:\Program Files (x86)\Nightly and not finding it. I found this working :

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