Built.io joins Software AG! Read all about the news.

Built.io Blog

Using GeckoDriver To Launch Firefox In Selenium 3


Selenium is one of the most common and useful automation tools for QA engineers. Selenium released Selenium 2.0 in 2011, along with new WebDriver APIs that provided native browser automation support. Recently it launched Selenium 3.0, with quite a few changes in its API.

When the 3.0 changes were being shipped by Selenium, Mozilla also made changes to its Firefox browser to make it more secure and stable. Consequently, the community-offered driver became obsolete.

Now in order to launch Firefox with Selenium 3, you will need GeckoDriver. In this blog post we’ll share how to do this properly.

About GeckoDriver

Gecko is the proprietary web browser engine developed by Mozilla. GeckoDriver is a proxy which is used to run Selenium 3 tests in Firefox.

GeckoDriver is compatible with all versions of Mozilla Firefox, unlike Selenium 2. This essentially means that Mozilla will have to introduce a new version (or update) of GeckoDriver with every new release of Firefox.

How To Run Tests In Firefox Using GeckoDriver

Let’s look at how to use this driver to run tests in Firefox. Before you start, make sure you have the following in place:


  • Selenium 3
  • Mozilla's GeckoDriver
  • Java

Note: If you're using Selenium 2, you do not need to set the system property. If you are using Selenium 3, you will need to specify the system property, which is also the case for Chrome and IE browsers.

Example code

import org.openqa.selenium.firefox.FirefoxDriver;
public class geckodriver {
      public static void main(String[] args) {
     // Path to geckodriver executable
            String geckoDriverPath = "<PATH_TO_GECODRIVER";
            System.setProperty("webdriver.firefox.marionette", geckoDriverPath);
            WebDriver driver = new FirefoxDriver();
            String title = driver.getTitle()
            System.out.println("Title is " + title );

When you run this code, the title will be printed, if you can see it in the console then Selenium 3 is running correctly and you can start testing.

Like what you read? Join our community to get more technical information, chances to win prizes, and more: built.io/community

Popular Posts

Subscribe to our blog