How to get Firefox working with Selenium WebDriver on Mac OSX?

We can get Firefox working with Selenium webdriver on Mac OS. For Firefox versions which are greater than 47, the geckodriver.exe file is to be used. We shall be able to launch the browser only after creating an object of the FirefoxDriver class.


WebDriver driver=new FirefoxDriver();

Visit the link − and go to the Browser segment. Click on the Documentation link below Firefox.

In the Supported platforms page, click on geckodriver releases link.

Then click on the link corresponding to Mac OS.

Once downloaded, extract the file and save the geckodriver.exe file to the /usr/local/bin location. As in Windows, we do not need to configure any path of the file in Mac.


import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;
public class FirefoxOnMac{
   public static void main(String[] args) {
      WebDriver driver = new FirefoxDriver();
      driver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS);

Updated on: 01-Feb-2021

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started