'Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7056; process output follows: null

I am using FireFox 18 with Selenium 2.29.0. While running test exception occurs

Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7056; process output follows: null

It seems strange that this error seldom occurs. Let's say I have 20 tests in my class, the "failed to connect" error occurs in 2 tests sometimes 3 and sometimes it doesn't occur.

Can't figure out why is it happening. If this is some how version problem or something else, none of the test case should run.



Solution 1:[1]

If you have path variable at your environment variables not set..then set it to location of Firefox.exe.... Or you can explicitly mention path to firefox.exe a

File pathToFirefoxBinary = new File(browser);
FirefoxBinary firefoxbin = new FirefoxBinary(pathToFirefoxBinary);
driver = new FirefoxDriver(firefoxbin,null);

This should work.. Or u can go for upgradation to 2.31.0

Solution 2:[2]

I had exactly the same problem when i was using firefox 28.0, I solved it by downgrading Firefox version to 27.0.1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Virendra Joshi
Solution 2 Shessuky