我有用来运行测试的盒子。看起来Jenkins会ssh进入并执行正在运行的特定作业中描述的命令。
这里我正在尝试运行Selenium Webdriver测试,但它告诉我在启动firefox时出现错误。最终的想法是完全在这个盒子上运行网络测试,并截取一些错误的屏幕截图。
我使用selenium-java-2.25.jar,Firefox10,linux操作系统。
有趣的是,我可以手动ssh到机器中,临时复制机器上另一个用户的魔力cookie (以获得X隧道),执行export DISPLAY=mydisplay:1.0
,然后使用ant启动我的selenium测试。这将调出firefox和测试。
这里有不同的线程似乎有完全相同的问题,我想我已经尝试了大多数。下面是我所做的:
export DISPLAY=mydisplay:1.0
。它还执行xclock
。这是可行的,因为我可以看到在VNC中显示了xclock。true.然而,上述方法都不能解决问题。
本地主机上的端口7055似乎根本不存在:
netstat -an | grep 7055
-不打印任何内容
这是我的/etc/hosts所说的:
1 127.0.0.1 localhost.localdomain localhost
2 ::1 localhost6.localdomain6 localhost6
也许与localhost有关:7055不存在?我不知道从这里到哪里去。但是,当我指定了mydisplay:1.0
时,为什么错误输出说它正在查找display: :0.0
最后是我收到的错误输出:
[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)
https://stackoverflow.com/questions/12588082
复制相似问题