I have tried with all version of firefox 45, 48, 49 and 50. I also have to mention the path for gecko driver(64bit) in my program but still firefox browser is not opening once I run my program. I am using selenium 3.0.1 java version.
Here is my code:
System.setProperty("webdriver.gecko.driver", "C:\\Users\\Desktop\\ecpipse2\\Selenium Library files\\geckodriver.exe");
driver = new FirefoxDriver();
baseUrl = "http://automationpractice.com/index.php";
org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:45120 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
Build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700'
System info: host: 'LAPTOP-C07CIJJB', ip: '192.168.0.6', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_102'
Driver info: driver.version: FirefoxDriver
If Gecko driver version is not correct then doesnt estabilish connection with Firefox.in above question , mentioned error was little bit confusing which doesn't say about Gecko driver is not compatible with selenium web driver and firefox version.My case now , its working fine with FF 49.0.2 , Selenium webDriver 3.0.1 and Geckodriver.exe 0.11.1