6

I am beginner to webdriver. I have setup all configurations. I am using firefox 27.0.1 version with selenium jar files 2.40.0. I have written code to open firefox browser with a URL. I am unable to run the code and got the below error. Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be Mac. It seems i should specify the firefox path to run the code. I tried to find the location on my mac. All i get is /Users/sathiyarengarajan/Library/Application Support/Firefox/Profiles. Tell me how to get the exact path on mac machine.

3

The typical location of FF is /Users/username/Applications/Firefox

To confirm the location right click on an FF shortcut and select "Get info". The dialog box displays.

  • 1
    I tried using Get info. Still I am only able to get the same above. I tried even Firefox help->troubleshoot information->Application Basics->Profile folder->show it in Finder. Any help to get the exact location would be helpful – STE Mar 3 '14 at 17:06
  • Why don't you just search the HD for Firefox? Use the search in Finder. – Merch Mar 3 '14 at 17:12
  • I tried. I got /Users/sathiyarengarajan/Downloads/Firefox 27.0.1.dmg. But still it didnt help. I uninstalled the firefox application. Once firefox is downloaded, i copied the firefox to the applications folder. Now I no need to set firefox path for selenium. Now things work – STE Mar 4 '14 at 11:06
  • No you should be good now, the applications folder is Selemiums default location for Firefox. – Merch Mar 4 '14 at 18:09
2

Not quite the same problem, but since I found this answer when googling, I'm providing my solution here too.

I'm trying to find the firefox executable to execute it from scripts like cucumber / selenium tests without hardcoding the path. Here's what I do:

Find it with Spotlight

firefox_paths = %x[mdfind "kMDItemFSName = Firefox.app"]
firefox_path = firefox_paths.split('\n').first.chomp
firefox_executable_path = File.join(firefox_path, '/Contents/MacOS/firefox')

Selenium::WebDriver::Firefox::Binary.path=firefox_executable_path

Another way would be to dump launch services database and grep it out there

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump \
  | grep -n7 org.mozilla.firefox \
  | grep path: \
  | awk '{ print($3) }'
2

I put the geckodriver to /usr/local/bin/ directory, when I start selenium test, the log show default search path on Mac OS

geckodriver::marionette INFO     Starting browser /Applications/Firefox.app/Contents/MacOS/firefox-bin

So make sure you have firefox-bin in above path, if not, you can make a soft link to your search path, for example:

ln -s /Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox-bin /usr/local/bin/firefox-bin
2

Let me share a crude but fool-proof way to find this:
On Terminal, type find / -name firefox

This will give you all paths to any file with firefox in the name. You should see these two lines in the output:

/Applications/Firefox.app/Contents/MacOS/firefox
/Applications/Firefox.app/Contents/MacOS/firefox-bin 

Hope this will helps.


Alternatively from the UI :

Go to Finder, under locate Firefox Applications Right click and Open Package Contents. You will see MacOS folder. Drill down each subfolders. You will find that the executables you will see will be under MacOS, named firefox and firefox-bin.

Hope this also helps.

0

I faced the same problem when I had multiple versions of FireFox browsers.

Got the error below:

Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: MAC

I Uninstalled the older version and the test started passing.

    package com.chamlabs.restfulservices.client.pages;

import org.openqa.selenium.safari.*;

import java.io.File;
import java.sql.Driver;

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.WebDriver;

public class LogInPage {

    public static void main(String[] args) throws InterruptedException {

        WebDriver driver = (WebDriver) new FirefoxDriver();
        driver.get("google.com");
        Thread.sleep(1000);
        driver.close();

    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.