Webdriver Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
Solution 1
Don't know if you resolved this problem, but I have just resolved the same issue from the other side.
It appears Selenium and Firefox have difficulty talking to each other - I suspect Firefox 'evolve' changes over a number of releases, so backward and forward compatibility are not always guaranteed, and incompatibility always seems to generate the same error.
My problem started when I moved from FF 15 to FF 16. Running on Ubuntu, this happens auto magically along with other upgrades but I believe this was the critical change.
The problem was resolved by moving from Selenium 2.24.1 to Selenium 2.25.0
As the selenium change is just download the jar file and run it instead of the old one,it's worth trying this as a quick and easy troubleshooter - if it doesn't help, just switch back. In your case, I'm not sure which version of Selenium to try, but I think 2.24 should work with FF 10.
Another issue I have found in the past is that Firefox would not run as root on Ubuntu. This happens if Selenium is running as a service, or possibly if it is fired up from a bash script or cron job. This may explain why it runs for you but not for Jenkins.
Solution 2
I had a similar issue. Maybe this answer will help you as well.
It looks like you have two different errors going on:
Unable to connect to host 127.0.0.1 on port 7055
Error: no display specified
The reason for the Unable to connect
error is that the version of Selenium Server does not know how to work with the newer version of Firefox. You need to download a newer version of the Selenium Server that supports the newer version of Firefox.
The reason for the Error: no display specified
error is that Firefox is being launched, but there is no X server (GUI) running on the remote host. You can use X11 forwarding to run Firefox on the remote host, but display it on your local host. On Mac OS X, you will need to download XQuartz in order to use X11 forwarding.
Solution 3
You need to check the browser compatibility before opting to test with Selenium:
https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG
This might help to answer the above question.
Solution 4
Get the latest Selenium jars (2.30) for FireFox 19
You can download the latest jars (2.31 as of writing) here: https://code.google.com/p/selenium/downloads/list
Solution 5
I resolved this issue by downgrading my Firefox to an older version that had previously worked well with Selenium-WebDriver. In my case, I had to downgrade back to Firefox 18 and this version worked with Selenium 2.27
Here is the link to get older versions of firefox: https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
user1636922
Updated on February 26, 2020Comments
-
user1636922 about 4 years
I have box where I run tests. It seems like Jenkins would ssh in and execute commands described in the specific job that's running.
Here I am trying to run my Selenium Webdriver tests, but it tells me that I have errors in launching firefox. The end idea is to run the webtests on this box entirely, and also take some screenshots of errors.
I am using selenium-java-2.25.jar, firefox 10, linux OS.
The funny thing is that I can ssh in manually into the box, temporarily copy the magic cookie from another user on the box (to get an X tunnel), do an
export DISPLAY=mydisplay:1.0
, then launch my selenium tests using ant. And this will bring up firefox and the tests just fine.There are various threads here that seem to have the exact same problem, and I think I've tried most of them. Here is what I've done:
Reboot the box, log back in with VNC.
Placed a bash script in Jenkins to run before running selenium tests. The bash script basically just does an
export DISPLAY=mydisplay:1.0
. It also executesxclock
. This works as I can see xclock being displayed in the VNC.iptables have been turned off
firefox is correctly located in /usr/bin/firefox
sshd_config shows having X11Forwarding as true.
Supposedly downgrading firefox helped some people, but I do not wish to do this. Webdriver should support FF 10 anyway.
However, none of the above solves the problem.
It doesn't seem like port 7055 on localhost even exists:
netstat -an | grep 7055
- Nothing printsThis is what my /etc/hosts says:
1 127.0.0.1 localhost.localdomain localhost 2 ::1 localhost6.localdomain6 localhost6
Perhaps it has something to do with localhost:7055 not existing? I am unsure where to go from here. still, why does the error output say it's looking for
display: :0.0
when I've specifiedmydisplay:1.0
?And finally the error output I receive:
[testng] org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: [testng] Xlib: connection to ":0.0" refused by server [testng] Xlib: No protocol specified [testng] [testng] Error: cannot open display: :0.0 [testng] Xlib: connection to ":0.0" refused by server [testng] Xlib: No protocol specified [testng] [testng] Xlib: connection to ":0.0" refused by server [testng] Xlib: No protocol specified [testng] [testng] Xlib: connection to ":0.0" refused by server [testng] Xlib: No protocol specified [testng] [testng] Error: cannot open display: :0.0 [testng] [testng] at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:109) [testng] at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:245) [testng] at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:109) [testng] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:185) [testng] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:178) [testng] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:174) [testng] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:92) [testng] at com.test.webtest.browser.BrowserFactory.createBrowser(BrowserFactory.java:24) [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [testng] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [testng] at java.lang.reflect.Method.invoke(Method.java:601)
-
Ripon Al Wasim about 11 yearsI'm using FF 19.0 and selenium-server-standalone-2.29.0.jar in Ubuntu. When I ran my selenium tests in Jenkins I got the same error: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: [testng] Error: no display specified [testng] Error: no display specified
-
Petr Peller about 11 years@RiponAlWasim Any luck resolving the issue? I am running 2.31.0 and have the same problem.
-
Ripon Al Wasim about 11 years@Petr Peller: what's the version of your FF?
-
Petr Peller about 11 years@RiponAlWasim It's FF19, but I found out, that the problem was in misconfiguration of my SeleniumDriver (I am using Mink for Behat). It was probably trying to connect to a wrong port.
-
Dev-Ria over 10 yearshow did you determine what port it was trying to connect to? What did you do to get it resolved?
-
Nick Perkins over 10 yearsThat "xhost +" fixed my problem, which was that running the webdriver with sudo was not opening a browser -- now it works.
-
Thomas over 10 yearsThis just solved my problem. I upgraded to Firefox version 26.0, which required me to update my Selenium standalone server from 2.35.0 to 2.37.0
-
Huluvu424242 almost 10 yearsFor me it works with Firefox 29.0 and selenium driver 2.39.0 too (Before i had the same problem at lubuntu 14.0.4)
-
Ajit S about 9 yearsThis was the problem I encountered. And it was not the browser in my case. It was the underlying OS. I am using Mac OS X - Yosemite. And only the latest selenium seems to be working with it.
-
B Seven about 8 yearsThis seems to be an ongoing issue. I got this error with Selenium Webdriver 2.47 and Firefox 44. Updating Selenium Webdriver to 2.53 fixed it.
-
TommyAutoMagically about 8 yearsNew URL is github.com/seleniumhq/selenium. If you just want the jars (e.g. selenium-server-standalone-2.53.0.jar), you can get them here: selenium-release.storage.googleapis.com/index.html
-
TommyAutoMagically about 8 yearstl;dr - Upgrade Selenium (.jar files here - selenium-release.storage.googleapis.com/index.html)
-
mido almost 8 yearslink is broken sir