How to use the Firefox Marionette Driver

Note: This post was triggered by a blog post on David Burns’ Blog which states that FirefoxDriver will stop working at version 47 of Firefox. 

It is easy to switch to using the new MarionetteDriver.

  • I suggest you try it on your code, and if your tests work, then keep using it.
  • If your tests fail, then it is most likely some defects in the newer MarionetteDriver. In which case:

Steps to switch:

  • Download the marionette driver
  • Unarchive it to a folder of your choice
  • In your code set the "webdriver.gecko.driver" property to the location of the .exe
  • Use the MarionetteDriver

The above is slightly different from the official instructions on the page.

The official instructions suggest you:

  • rename the file to ‘wires.exe’ and
  • add it to your path.

I did rename it to wires.exe, mainly to keep the code consistent so I wouldn’t have to update the code everytime I change the version of the marionette driver.

But I didn’t add it to the path. I’d rather control that in the code when the option is provided.

So for Firefox 45 and 46 my start driver code looks like this:

WebDriver driver = new FirefoxDriver();

And for Firefox 47 and above my code looks like this:

String currentDir = System.getProperty("user.dir");
String marionetteDriverLocation = currentDir + "/tools/marionette/wires.exe";
System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);
WebDriver driver = new MarionetteDriver();

I have a working example of this in the startUsingSeleniumWebDriver code on github:

This entry was posted in FAQ, Selenium Simplified Blog, WebDriver. Bookmark the permalink.

26 Responses to How to use the Firefox Marionette Driver

  1. Mike says:

    Link http://www.theautomatedtester.co.uk/blog/2016/selenium-webdriver-and-firefox-46.html
    no longer exist. so maybe whole thing is just not confirmed.

    • Alan says:

      Hi Mike. Looks that way. I’ll have to update the blog post at some point. Not sure when it will happen, but fortunately not as soon as suggested by the blog post.

  2. Andrey says:

    Did you notice any performance regressions after switching to new driver?

    • Alan says:

      Not really any performance issues. But plenty of functional issues. I haven’t switched over to Marionette yet. I’ll stick with built in FirefoxDriver until I have to change. Nice Site by the way.

  3. Pingback: Testing Bits – 4/24/16 – 4/30/16 | Testing Curator Blog

  4. Pingback: Using Portable Firefox 46 with WebDriver » Selenium Simplified

  5. Pingback: Using Portable Firefox 46 With Webdriver – Open Code Group

  6. Pingback: Using Portable Firefox 46 With Webdriver -

  7. Pingback: Using Portable Firefox 46 With Webdriver – DZone News | Screenny

  8. Sandeep says:

    Hi I am unable to use marionette with Remote webdriver. Here is the eg:

    System.setProperty(“webdriver.gecko.driver”, “…\\wires-0.6.2-win\\wires.exe”);
    DesiredCapabilities cap = DesiredCapabilities.firefox();

    cap.setCapability(“marionette”, true);
    cap.setBrowserName(“firefox”);

    driver = new RemoteWebDriver(new URL(“http://10.121.64.185:4444/wd/hub”), cap);//true to enable the JS

    final String url = “https://www.google.com/”;

    • Alan says:

      Your hub isn’t going to pick up the property your code set. You probably want to add the folder that contains wires.exe to the path on whatever machine your hub is running on.

    • Munander Singh says:

      Easy way to use geckodriver with latest java client driver.
      1) install geckodriver zip file from git hub. Unzipped the folder, their must be one geckodriver.exe file.
      2) Set the system property in your code as mention below :

      System.setProperty(“webdriver.firefox.marionette”,”E:\\Interview_Workspace\\geckodriver-v0.11.1-win64\\geckodriver.exe”);

      WebDriver driver= new FirefoxDriver();
      String url= “https://google.com/”;
      driver.get(url);

      I hope this will help you.

  9. Pingback: Use Selenium WebDriver 2.53.1 with Firefox 47.0.1 » Selenium Simplified

  10. Elhorla says:

    Hi alan how i can use a proxy http in this case (c#) :

    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    var driverService = FirefoxDriverService.CreateDefaultService();
    driverService.FirefoxBinaryPath = @”C:\Program Files (x86)\Mozilla Firefox\firefox.exe”;
    driverService.HideCommandPromptWindow = true;

    DesiredCapabilities cap = new DesiredCapabilities();
    cap.SetCapability(“marionette”, true);

    driver = new FirefoxDriver(driverService, new FirefoxOptions(), TimeSpan.FromSeconds(30));

    • Alan says:

      Hi,

      I think it should just be setting a capability:

      DesiredCapabilities capabilities = new DesiredCapabilities();
      capabilities.setCapability(CapabilityType.PROXY, proxy);

      But I haven’t managed to get proxies working with Marionette yet, so I assume it isn’t implemented yet.

      Alan

  11. Divya Srinivasan says:

    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.support.ui.Select;

    public class Driverusinuint {
    System.setProperty(“webdriver.gecko.driver”, “C:\\geckodriver.exe”);
    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability(“marionette”, true);
    WebDriver driver = new FirefoxDriver(capabilities);

    @Before
    public void Beforetest()
    {
    driver.manage().window().maximize();
    driver.get(“url”);
    }
    @After
    public void aftertest()
    {
    driver.quit();
    }
    @Test
    public void logintest()
    {
    my code

    }

    }

    What am i doing wrong . Please help

    • Alan says:

      When you type code, and you see a syntax error in the editor. Stop and fix it. The error won’t get any better by adding more lines.

      In your code you have a syntax error on `System.setProperty(“webdriver.gecko.driver”, “C:\\geckodriver.exe”);`

      This can’t be run at a class level, you need to add this into your @Before or @Test code.

      • Divya says:

        Thanks for the reply. iam newbie to this and trying my best. As advised i tried to put it in @before or @test , driver will not be accessible then.

        can you please let me know how to make this code work.

        • Alan says:

          Sounds like you should not be using @Before and @After until you know a little more Java. Put all your code in your @Test method and get that working first.

  12. Errolfast says:

    Hello i’m trying to use selenium with python on my mac. The selenium installed well, and importing the webdriver from selenium is working, but when i tell it “driver =webdriver.Firefox()” it says I need geckodriver excecutable to be in the PATH. I’m relatively new to coding and I don’t know how to fix this, could someone help me out?

  13. See my specification is ff 49 , selenium 3.0.1 and have installed gecko driver 0.11.1, but IF I run ,I always get only this page “https://support.skype.com/en/faq/FA34612/what-is-the-skype-extension”, instead of the page that I have mentioned below code :
    driver.get(“https://www.facebook.com/”);

    My full code :
    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability(“marionette”, true);
    System.setProperty(“webdriver.gecko.driver”, “E:\\Shivprakash\\Selenium\\geckodriver.exe”);

    driver = new MarionetteDriver();
    driver.get(“https://www.facebook.com/”);

    Plus the program doesn’t stop unless I close the browser manually

    • Alan says:

      I uninstalled the skype extension. That seemed to be the easiest way to fix it.

      you would need to driver.close() or driver.quit() to close the browser.

  14. Maria says:

    Hy, I try with ruby-cucumber but I havent any result, the error continues.
    I heve Selenium 3.0 and firefox 59.
    Any can help me?
    Thx

    • Alan says:

      Sorry, I don’t really use Ruby-cucumber, you’re probably better off asking that question on the ruby-cucumber site or forums.

Leave a Reply

Your email address will not be published. Required fields are marked *