Selenium 3 – Launching Firefox Browser using geckodriver

Selenium recently launched its one of the major release, i.e., Selenium 3 – beta. You can download it from here. In this new version, one of the major change is the way Mozilla Firefox Browser is invoked. Till Selenium 2, there was no need of having any Driver exe for Mozilla. But now GeckoDriver is necessary for invoking Firefox Browser.

Gecko Driver can be downloaded from GitHub. After downloading the Driver, we have to set the System Property, the same way we did for Chrome and Internet Explorer Driver.

// Setting the path of Gecko Driver
WebDriver Driver = new FirefoxDriver();

The minimum version of Mozilla required for Selenium 3 is 48 and above.

Rest the code remain same as we did earlier. Let us execute the same code using geckodriver.

package com.qatechhub.day1;
import org.openqa.selenium.firefox.FirefoxDriver;
public class WorkingWithFirefox {

	FirefoxDriver Driver = new FirefoxDriver();
	String url = "";
	public void invokeBrowser(){
		/* To Maximize the window */
		/* To delete all the cookies of the browser */
		/* To navigate to a particular URL */
		String titleOfPage;
		/* To get The Title of the page */
		titleOfPage = Driver.getTitle();
		System.out.println("Title of the page is : " + titleOfPage);
		String currentUrl;
		/* To get The url of the page */
		currentUrl = Driver.getCurrentUrl();
		System.err.println("Title of the page is : "+ currentUrl);
		String pageSource;
		/* To get The source code current page */
		pageSource = Driver.getPageSource();
		System.out.println("Page Source : "+ pageSource);
	public void closeBrowser(){
		/* To close current active window of the browser */
	public void closeAllBrowser(){
		/* To close all the opened browser session*/

Note: If you are using Selenium 2.53.1 or below version, there is no need set the system path variable.

Below are some of the other important changes in Selenium 3:

  • Selenium RC (core Selenium API’s) are available only through leg-rc packages.
  • JAVA version 8+ is supported.
  • New HTML-table runner is introduced by Selenium WebDriver.
  • Official support for IE requires version 9 or above.

You can also go through below link for a Webinar conducted by Simon Stewart (The man who developed Selenium WebDriver) and is currently working as Selenium Project lead.

Video Source: Applitools – Automated Visual Testing

Selenium 3 explained via Simon Stewart himself

PS: For any questions, queries or comments feel free to write us at or

Saurabh Dhingra

About the Author

Saurabh Dhingra

Follow Saurabh Dhingra: