首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >45000毫秒后,Webdriver无法连接到端口7055上的主机127.0.0.1

45000毫秒后,Webdriver无法连接到端口7055上的主机127.0.0.1
EN

Stack Overflow用户
提问于 2012-09-26 01:27:54
回答 29查看 323.1K关注 0票数 140

我有用来运行测试的盒子。看起来Jenkins会ssh进入并执行正在运行的特定作业中描述的命令。

这里我正在尝试运行Selenium Webdriver测试,但它告诉我在启动firefox时出现错误。最终的想法是完全在这个盒子上运行网络测试,并截取一些错误的屏幕截图。

我使用selenium-java-2.25.jar,Firefox10,linux操作系统。

有趣的是,我可以手动ssh到机器中,临时复制机器上另一个用户的魔力cookie (以获得X隧道),执行export DISPLAY=mydisplay:1.0,然后使用ant启动我的selenium测试。这将调出firefox和测试。

这里有不同的线程似乎有完全相同的问题,我想我已经尝试了大多数。下面是我所做的:

  • 重新启动计算机,使用VNC重新登录。
  • 在Jenkins中放置了一个bash脚本,以便在运行selenium测试之前运行。bash脚本基本上只执行一个export DISPLAY=mydisplay:1.0。它还执行xclock。这是可行的,因为我可以看到在VNC中显示了xclock。true.
  • Supposedly
  • iptables已经被关闭了,而火狐的降级是正确的,它位于
  • X11Forwarding as true.
  • Supposedly帮助了一些人,但我不想这样做。Webdriver无论如何都应该支持FF 10。

然而,上述方法都不能解决问题。

本地主机上的端口7055似乎根本不存在:

netstat -an | grep 7055 -不打印任何内容

这是我的/etc/hosts所说的:

代码语言:javascript
复制
  1 127.0.0.1               localhost.localdomain localhost
  2 ::1             localhost6.localdomain6 localhost6

也许与localhost有关:7055不存在?我不知道从这里到哪里去。但是,当我指定了mydisplay:1.0时,为什么错误输出说它正在查找display: :0.0

最后是我收到的错误输出:

代码语言:javascript
复制
[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)
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12588082

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档