Skip to main content
Home
  • Tutorials
    • Quality Assurance
    • Software Development
    • Machine Learning
    • Data Science
  • About Us
  • Contact
programsbuzz facebook programsbuzz twitter programsbuzz linkedin
  • Log in

Main navigation

  • Tutorials
    • Quality Assurance
    • Software Development
    • Machine Learning
    • Data Science
  • About Us
  • Contact

How to Launch Firefox Browser in Selenium

Profile picture for user ksharma
Written by ksharma on 09/26/2020 - 10:14

To launch a firefox browser using selenium. First we need to download the gecko driver, also make sure firefox is installed on your system. 

Step 1: Open Firefox browser and Go to Firefox -> About Firefox and check your browser version or update to the latest version if you want.

Step 2: Open this link or you can search in google by typing "download geckodriver"

Step 3: Click Here to check if your browser is compatible with current Selenium version and driver. This will give you list of supported platforms. Your can also check the table below.

geckodriver Selenium Firefox
    min max
0.31.0 ≥ 3.11 (3.14 Python) 91 ESR n/a
0.30.0 ≥ 3.11 (3.14 Python) 78 ESR 90
0.29.1 ≥ 3.11 (3.14 Python) 60 90
0.29.0 ≥ 3.11 (3.14 Python) 60 90
0.28.0 ≥ 3.11 (3.14 Python) 60 90
0.27.0 ≥ 3.11 (3.14 Python) 60 90
0.26.0 ≥ 3.11 (3.14 Python) 60 90
0.25.0 ≥ 3.11 (3.14 Python) 57 90
0.24.0 ≥ 3.11 (3.14 Python) 57 79
0.23.0 ≥ 3.11 (3.14 Python) 57 79
0.22.0 ≥ 3.11 (3.14 Python) 57 79
0.21.0 ≥ 3.11 (3.14 Python) 57 79
0.20.1 ≥ 3.5 55 62
0.20.0 ≥ 3.5 55 62
0.19.1 ≥ 3.5 55 62
0.19.0 ≥ 3.5 55 62
0.18.0 ≥ 3.4 53 62
0.17.0 ≥ 3.4 52 62

Here Firefox Extended Support Release (ESR) is an official version of Firefox developed for large organizations like universities and businesses that need to set up and maintain Firefox on a large scale.

Step 4: Here driver file is different for each operating system Windows exe will not work on Mac or Linux system. Unlike chrome here driver is different for 64 and 32 bit. Once you will click on link, download will start.

How to Launch Firefox Browser in Selenium

Step 5: Unzip and Paste downloaded file to drivers folder or directory of your choice.

Step 6: Now open your driver configuration file and paste following code. We will be executing this with Java runner using main class.

package com.pb.seltest.util;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class AppTest 
{
	public static void main(String args[])
	{
		System.setProperty("webdriver.gecko.driver",System.getProperty("user.dir") + "//drivers//geckodriver");
		
		WebDriver driver;
		driver = new FirefoxDriver();
		driver.get("http://www.automationpractice.com");
	}
}

In above code,

  • setProperty will set the system property to value webdriver.gecko.driver and the path is given to get the gecko driver.
  • Here WebDriver is the main interface which is extended by super most interface SearchContext.
  • new FirefoxDriver(), Here we are creating instance of FirefoxDriver, Firefox Driver is a class which also extends RemoteWebDriver class like ChromeDriver class do.
  • driver.get() is used to navigate particular URL(website) and wait till page load.
Related Content
Selenium Tutorial
How to Launch Chrome Browser in Selenium
How to launch Edge Browser in Selenium
  • Log in or register to post comments

Choose Your Technology

  1. Agile
  2. Apache Groovy
  3. Apache Hadoop
  4. Apache HBase
  5. Apache Spark
  6. Appium
  7. AutoIt
  8. AWS
  9. Behat
  10. Cucumber Java
  11. Cypress
  12. DBMS
  13. Drupal
  14. GitHub
  15. GitLab
  16. GoLang
  17. Gradle
  18. HTML
  19. ISTQB Foundation
  20. Java
  21. JavaScript
  22. JMeter
  23. JUnit
  24. Karate
  25. Kotlin
  26. LoadRunner
  27. matplotlib
  28. MongoDB
  29. MS SQL Server
  30. MySQL
  31. Nightwatch JS
  32. PactumJS
  33. PHP
  34. Playwright
  35. Playwright Java
  36. Playwright Python
  37. Postman
  38. Project Management
  39. Protractor
  40. PyDev
  41. Python
  42. Python NumPy
  43. Python Pandas
  44. Python Seaborn
  45. R Language
  46. REST Assured
  47. Ruby
  48. Selenide
© Copyright By iVagus Services Pvt. Ltd. 2023. All Rights Reserved.

Footer

  • Cookie Policy
  • Privacy Policy
  • Terms of Use