CASE STUDYMy tests are written with Thucydides + Firefox Driver. Test suite is successfully running on my local machine. My task is to set up tests in CI on remote server. I’m using latest Webdriver and Firefox versions (Selenium documentation says they are compatible). Nevertheless, tests failed with “Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms”.
I faced this exception several times before. Every time I solved that issue by downgrading Firefox browser on my test environment and turning off automatic updates. This time it didn’t help. I tried several FF & Selenium versions without any success.
Then I found information that Firefox driver runs on 7055 port by default, if the port is busy it tries to run on 7054 or 7056 ports. So when those 3 ports are taken by some process - Webdriver won’t be able to start.
Indeed, I checked if those ports were taken using command:
lsof -i | grep 7055
It turned out that they were busy and this was a cause of the exception. I killed the processes on the named ports and my tests started running successfully.
So as a summary. I was using Thucydides + Firefox driver. In some cases when Thucydides work was interrupted unexpectedly it doesn’t finish it’s processes correctly. So some Firefox processes were hanging on mentioned above 7054-7056 ports and didn’t let driver start over again.
Hope this post will help someone to fix quite popular issue with Webdriver.