Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Launch of Firefox Browser through Selenium 3: | Make Selenium Easy

Posted on 11/28/2018 By admin

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:


import org.openqa.selenium.firefox.FirefoxDriver;

public class LaunchFirefoxBrowser {

public static void main(String[] args) {

//setting path of geckodriver
System.setProperty("webdriver.gecko.driver", "D:/Organised/Selenium_Frameworks/DataDrivenFramework/exefiles/geckodriver.exe");
// Launching firefox browser
FirefoxDriver FDriver= new FirefoxDriver();
// Opening a URL
FDriver.get("https://www.google.com");
// Closing the browser
FDriver.quit();
}
}

Note:

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.

#HappyLearning

Uncategorized

Post navigation

Previous Post: How Much Java Required For Selenium? | Make Selenium Easy
Next Post: How to Verify if Options in Dropdown are Sorted as Expected In Selenium WebDriver – Java | Make Selenium Easy

Related Posts

February 27, 2017 – Make Selenium Easy Uncategorized
All about WebDriver: Methods And Its Usages Uncategorized
TestNG Tutorials 52: DataProvider in TestNG – Accessing DataProvider Methods From Another Class Test Class | Make Selenium Easy Uncategorized
Creating Object Repository In Selenium WebDriver Using Properties File As An External Source Uncategorized
Amod Mahajan, Author at Make Selenium Easy – Page 51 of 51 Uncategorized
May 13, 2018 – Make Selenium Easy Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark