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.

amazpyel
7896 silver badges20 bronze badges
asked Mar 3, 2014 at 16:31

5 Answers 5

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.

Bharat Mane
6,78512 gold badges42 silver badges69 bronze badges
answered Mar 3, 2014 at 16:39
4
  • 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 Commented Mar 3, 2014 at 17:06
  • Why don't you just search the HD for Firefox? Use the search in Finder. Commented Mar 3, 2014 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 Commented Mar 4, 2014 at 11:06
  • No you should be good now, the applications folder is Selemiums default location for Firefox. Commented Mar 4, 2014 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ドル) }'
answered Mar 27, 2014 at 9:25
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
answered Apr 8, 2017 at 0:24
2

Let me share a crude but fool-proof way to find this:
On Terminal, type find /Applications -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.

answered Sep 8, 2017 at 5:53
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();
 }
}
answered Mar 31, 2019 at 6:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.