Cannot find firefox binary in PATH. Make sure firefox is installed Cannot find firefox binary in PATH. Make sure firefox is installed selenium selenium

Cannot find firefox binary in PATH. Make sure firefox is installed


File pathToBinary = new File("C:\\user\\Programme\\FirefoxPortable\\App\\Firefox\\firefox.exe");FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary);FirefoxProfile firefoxProfile = new FirefoxProfile();       WebDriver driver = new FirefoxDriver(ffBinary,firefoxProfile);


Another option is to configure the server rather than the test client.

Configure the slave node service so that it knows where the firefox is. Install location can change from node to node, or even need multiple services running on a node to support access to different versions of FF.

java -jar "selenium-server-standalone-2.2.0.jar" -Dwebdriver.firefox.bin="C:\FirefoxCollection\Mozilla Firefox 36.0\firefox.exe"


Make sure that firefox must install on default place like ->(c:/Program Files (x86)/mozilla firefox OR c:/Program Files/mozilla firefox, note: at the time of firefox installation do not change the path so let it installing in default path)If firefox is installed on some other place then selenium show those error.

If you have set your firefox in Systems(Windows) environment variable then either remove it or update it with new firefox version path.

If you want to use Firefox in any other place then use below code:-

As FirefoxProfile is depricated we need to use FirefoxOptions as below:

New Code:

File pathBinary = new File("C:\\Program Files\\Mozilla Firefox\\firefox.exe");FirefoxBinary firefoxBinary = new FirefoxBinary(pathBinary);   DesiredCapabilities desired = DesiredCapabilities.firefox();FirefoxOptions options = new FirefoxOptions();desired.setCapability(FirefoxOptions.FIREFOX_OPTIONS, options.setBinary(firefoxBinary));

The full working code of above code is as below:

System.setProperty("webdriver.gecko.driver","D:\\Workspace\\demoproject\\src\\lib\\geckodriver.exe");File pathBinary = new File("C:\\Program Files\\Mozilla Firefox\\firefox.exe");FirefoxBinary firefoxBinary = new FirefoxBinary(pathBinary);   DesiredCapabilities desired = DesiredCapabilities.firefox();FirefoxOptions options = new FirefoxOptions();desired.setCapability(FirefoxOptions.FIREFOX_OPTIONS, options.setBinary(firefoxBinary));WebDriver driver = new FirefoxDriver(options);driver.get("https://www.google.co.in/");

Download geckodriver for firefox from below URL:

https://github.com/mozilla/geckodriver/releases

Old Code which will work for old selenium jars versions

File pathBinary = new File("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");FirefoxBinary firefoxBinary = new FirefoxBinary(pathBinary);FirefoxProfile firefoxProfile = new FirefoxProfile();       WebDriver driver = new FirefoxDriver(firefoxBinary, firefoxProfile);