Firefox Marionette Driver

As announced some time ago, FirefoxDriver will nolonger work after Firefox 47 has been released. There are 2 options;

  1. Downgrade Firefox (version < 47)
  2. Implement Marionette Driver. (Marionette WebDriver)

This blogpost will cover the implementation of Marionette Driver. Luckily it’s not too hard to switch to MarionetteDriver. Following these steps:

  1. Download Marionette Driver
  2. Extract the file
  3. Set the webdriver.gecko.driver property to the location path of Marionette driver
  4. Adjust the code, to something like this:
    	@BeforeClass
    	public void startFirefox() {
    		System.setProperty("webdriver.gecko.driver", "path/to/geckodriver");
    		final WebDriver driver = new FirefoxDriver();
    		driver.get("http://www.google.com");
    	}
    

Alternatively we can implement a method to find the file on path:

	private static String findFileOnPath(final String fileName) {
		return MarionetteDriverTest.class.getClassLoader().getResource(fileName).getPath();
	}

MarionetteDriverTest is the classname.

And use it like this:

	@BeforeClass
	public void startFirefox() {
		System.setProperty("webdriver.gecko.driver", findFileOnPath("geckodriver")); //assuming the file is located in the resources folder
		final WebDriver driver = new FirefoxDriver();
		driver.get("http://www.google.com");
	}

Share This:

One thought on “Firefox Marionette Driver

Leave a Reply

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