3

Firefox is showing "Cannot find firefox binary in PATH." error in MAC OS. As per my understanding this issue occurs if the Mozilla is not installed in their default location. I am new in MAC OS

I have also tried with firefox profile and already I have set selenium provided DesiredCapabilities

WebDriver driver = new FirefoxDriver(new FirefoxBinary(new File("/Applications/Firefox.app/Contents/MacOS/firefox-bin")), profile);

I have also tried with different path of mozilla in MAC OS like:-

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

Also please provide a snippet for the same.

Chrome is working fine for me in MAC OS. Only Mozilla is creating problem

Surely, I am missing something. I am attaching the snapshot regarding same.

Also, Is there any method present by which I can locate any application installed location using java code?

enter image description here

enter image description here

3 Answers 3

14

According to https://github.com/SeleniumHQ/selenium/wiki/FirefoxDriver there is a property you have to set to set the binary path:

webdriver.firefox.bin

so i assume you have to do following:

    System.setProperty("webdriver.firefox.bin","/Applications/Firefox.app/Contents/MacOS/firefox-bin");
    WebDriver driver = new FirefoxDriver();

I hope this helps :)

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks man :) ...... System.setProperty("webdriver.firefox.bin","/Applications/Firefox20.0"); worked for me .. upvoted :)
0

If you have installed firefox, check whether the Firefox application is in the /Applications folder. If not move the application to /Application folder and run the test again.

If above worked, you don't have to add a system property "webdriver.firefox.bin"

Comments

0

Possibly updated for the current situation with this I did this:

  1. Installed geckodriver, available since 2018, to /usr/local/bin (arbitrary choice and made sure it could execute. This placement made it unnecessary to add it to my $PATH.
  2. Installed Firefox to /Applications (I had the developer version)
  3. Added this line to my setUp method: driver = new FirefoxDriver(new FirefoxOptions().setHeadless(true));

All this in macOS 10.11 "Big Sur" (aarch64) using current selenium.

Comments

Your Answer

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.