Make Selenium Easy

Launch of Firefox Browser through Selenium 3:

Last updated on April 23rd, 2017 at 03:25 pm

In last post, we have learnt how to launch Chrome driver through selenium. In this post we will learn:

  1. How to launch Firefox browser through Selenium 3.
  2. Open a URL in browser.
  3. Close the browser.

Selenium 3 has been launched. In selenium 2, it was very easy to launch Firefox browser as Selenium 2 had native implementation of Firefox browser. As we know that Selenium provides a driver class for each browser. So to open Firefox browser, we just need to create an object of FirefoxDriver class as below:

FirefoxDriver driver= new FirefoxDriver();

Note: “driver” is an object or reference variable of class FirefoxDriver. You can name it anything you wish. Someone asked me that is “driver” fixed. So, I am putting this point here.

Selenium 3 has not any native implementation of Firefox browser. Marionette is the next generation of FirefoxDriver. Marionette is an automation driver for Mozilla’s Gecko engine. Gecko is the proprietary web browser engine design and developed by Mozilla. It can remotely control either the UI or the internal JavaScript of a Gecko platform, such as Firefox. So, to support Selenium webdriver, Gecko has released Geckodriver which is a proxy for using W3C WebDriver-compatible clients to interact with Gecko-based browsers.

How to launch Firefox browser in SELENIUM 3:

Step 1: Download the latest geckodriver from here as per your system configuration. I will download for windows 64 bits.

Step 2: Extract it and so that you will get geckodriver.exe.

Step 3: Just set the system property using System class and setProperty method of it as we did for chrome browser in previous post.

Java code for opening Firefox browser is as below:


There are some issues with geckodriver. Sometimes we will face:

  1. Browser remains minimized after opening.
  2. quit() will give exception.
  3. Syncing issue between versions of geckodriver and Firefox.

That’s it for this post. I hope, you must have get above concepts. Feel free to ask any doubt if you have or any suggestion for me.


Author: Amod Mahajan

6 thoughts on “Launch of Firefox Browser through Selenium 3:

  1. I have observed the quit option is not working several times, how can we fix the quit function issue for Firefox driver?

    1. Hi Uma,

      It is quite a problem in firefox. Sometimes close also does not work. You can use javascript way to close a window. Command is “window.close()”.

  2. @Amod…Thank you for your useful post
    Here are some doubts,
    Is it useful if we start using selenium 3 instead other lesser versions??
    Is is necessary to adopt selenium 3??

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.

Launch of Firefox Browser through Selenium 3:

by Amod Mahajan time to read: 2 min
%d bloggers like this: