Chat with us, powered by LiveChat
INDIA +91 964 309 2571 | USA +1669 327 4700

Meanwhile, A conversation is going on b/w two Automation Engineers somewhere in a parallel universe:

Jai: Hey, Could you please check my scripts? Its running fine on Chrome and IE browsers but Firefox.
Veeru: Hmm, did you check the Selenium and Firefox version compatibility?
Jai: Not Really, It’s too hard to remember the version compatibility, Why don’t they provide a common solution for all Firefox versions? just like chrome and IE.

Thakur: Hey Guys, Did you check one of the features in Selenium 3.0 (stable release)? It will resolve all your Firefox related version compatibility issues:

“* Firefox is only fully supported in version 47.0.1 or earlier. Support
for later versions of Firefox is provided by gecko driver, which is
based on the evolving W3C WebDriver spec, and uses the wire protocol
in that spec, which is liable to change without notice.”

For Detailed changelog: – Java – Ruby

What is GeckoDriver and from where would we get that?

Hold on!!! Lets first see what is “Gecko”?smile

Gecko is a web browser engine used in many applications developed by Mozilla Foundation and the Mozilla Corporation, most noticeably the Firefox web browser, its mobile version other than iOS devices, their email client Thunderbird and many other open source software projects. You can get more information about Gecko here –

GeckoDriver is a proxy for using W3C WebDriver-compatible clients to interact with Gecko-based browsers i.e. Mozilla Firefox in this case. This program provides the HTTP API described by the WebDriver protocol to communicate with Gecko browsers. It translates calls into the Marionette automation protocol by acting as a proxy between the local and remote ends.

Earlier, this is how Selenium used to work with Firefox:

public class FirefoxTest {

	public void openFirefox() {
		WebDriver driver = new FirefoxDriver();

You just write the code to instantiate the WebDriver and open Firefox. If you just run this code, you would see that Firefox browser would get opened and would be displayed in the browser. This is how it worked with Selenium 2.53.1 and before.

Now, What would happen if you use the same method to instantiate the Firefox in Selenium 3.0:

You will get a run-time error:

“java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property;”

Here comes the Geckodriver, which would support all latest versions of Firefox (I tried with v50.0.1, and it worked like a cheese):

Steps to Download GeckoDriver

Follow the steps given below to download it –

  1. Open this Github page –
  2. Download the latest release (depending upon your OS). Till date, gecko is the latest windows version. So click on the link to download it

After that, Use the below method to work with gecko driver:

public class FirefoxTest {
	public void FirefoxTest1() {
		System.setProperty("webdriver.gecko.driver",Path of your GeckoDriver.exe file);
		FirefoxDriver driver = new FirefoxDriver();

In Case you don’t want to increase the line of codes in your program, you can directly set the geckodriver path in your System’s Environment variable and use the traditional way to instantiate the web driver.

Note: In case you are thinking, what happened to MarionetteDriver? it has been deprecated but still, works. FirefoxDriver now defaults to use GeckoDriver, the wires.exe is now renamed to geckodriver.exe and we can still use a legacy version of Firefox before version 48 by setting the marionette capability to false.

Well, you just have to:

set the Firefox driver capability “marionette” to false
set the firefox_binary capability to the path of your legacy firefox

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", false);
       new File(path of your legacy firefox exe).
WebDriver driver = new FirefoxDriver(capabilities);

I would write more on Browser Capabilities and Profiles in later articles. Thanks for your Time. Happy Learning!!

Jai: Woo Hooo!!!, My script is now working fine with all latest Firefox versions. smile