Selenium firefox driver session fails with : Could not start a new session. Response code 500. Message: Expected browser binary location, but unable to find binary in default location,

 Error:

With Firefox driver /gecko driver
Could not start a new session. Response code 500. Message: Expected browser binary location, but unable to find binary in default location,


Solution:

This is due to if you are using set property with:

"System.setProperty("webdriver.gecko.driver", "geckodriver.exe");" 


change to:

System.setProperty("webdriver.driver.gecko", "C:\\geckodriver.exe" ); 

Selenium firefox driver session fails with : Could not start a new session. Response code 500. Message: Expected browser binary location, but unable to find binary in default location,

 Error: With Firefox driver /gecko driver Could not start a new session. Response code 500. Message: Expected browser binary location, but u...