Introduce to Cannot Find Firefox Binary in PATH
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
Read more: action-class-in-selenium
A better approach would be to use System.setProperty(path of firefox)
click here to know more.
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.