How to resolve Cannot find firefox binary in PATH Error In Selenium

Share and Enjoy !

WebDriver does not always supports the latest Firefox.It is better to use ESR version of Firefox. Or else downgrade the Firefox to at least 2-3 versions to see your test running.

How to get downgrade:
1. Uninstall the latest version
2. Find out the version by searching google
3. Install the FF
4. Change the preference- Not update automatically

A better approach would be to use System.setProperty(path of firefox)

WebDriver driver;
System.setProperty("webdriver.firefox.bin", "C:\Program Files (x86)\Mozilla Firefox\firefox.exe")
driver=new FirefoxDriver();

Using of a profile would help us. It is better to create a test profile.

Second thing to look if the driver is getting any popup saying the above written error message. This typically happens when our antivirus plays its role. Antivirus thinks it is a virus effect to control a .exe and operation on browser. Uninstall the Firefox and the AV. Then install Firefox first and then the AV. It will work !! If uninstalling AV makes Firefox work, we have no other choice.

Third,Check for the permission of Firefox.exe file. In a secure environment,we faced it once.
Last, but very rare-check out the plugins. One of the faulty plugin may crash the Firefox or prevents it to open. Deactivate all plugins and use your test code to run.

Share and Enjoy !

READ  Why Xpath Is Slower in Browsers Specially In Internet Explorer?

One thought on “How to resolve Cannot find firefox binary in PATH Error In Selenium

Leave a Reply

Your email address will not be published. Required fields are marked *