2016-02-05 112 views
0

我正在执行Jenkins的硒测试用例。我也想运行UI测试用例。但是当Jenkins被构建时,浏览器并没有启动。我使用Cent OS和FireFox。路径指定如下。浏览器从jenkins运行时不会自动启动

堆栈跟踪

org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/lib64/firefox/firefox) on port 7055; process output follows: 
Error: cannot open display: :99 
Error: cannot open display: :99 

Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35' 
System info: host: 'nila.ejyothi.net', ip: '192.168.202.35', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.20.1.el7.x86_64', java.version: '1.7.0_91' 
Driver info: driver.version: FirefoxDriver 
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:130) 
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246) 
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114) 
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193) 
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186) 
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182) 
    at com.fetchinglife.application.modules.utilities.CommonFunctions.initBrowser(CommonFunctions.java:74) 
    at com.fetchinglife.application.modules.employee.EmployeeScheduleFunctionalTest.StartBrowser_NavURL(EmployeeScheduleFunctionalTest.java:34) 
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: 
Error: cannot open display: :99 
Error: cannot open display: :99 

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118) 
Standard 

请给我一个解决方案吗?

+1

请提供詹金斯日志(用跟踪和完整的堆栈跟踪),所以我们可以看到的问题是什么。 –

+0

如果测试期望用户界面,则需要考虑一些工具来提供“显示”。例如xvnc。 https://wiki.jenkins-ci.org/display/JENKINS/Xvnc+Plugin。在我们去那里之前,请提供您看到的错误的详细信息。 – Jayan

+0

上述错误是我在构建Jenkins时在我的堆栈跟踪中发现的。我需要在后台运行它并列出结果集。 – rParvathi

回答

-1

X11转发需要在客户端和服务器端都启用。

在客户端,ssh的-X(大写X)选项启用X11转发,并且您可以使用ForwardX11的默认值(对于所有连接或特定连接),在〜/ .ssh/config中是yes 。

在服务器端,必须在/ etc/ssh/sshd_config中指定X11Forwarding yes。请注意,默认值是不转发(某些发行版在默认的/ etc/ssh/sshd_config中将其打开),并且用户无法覆盖此设置。

xauth程序必须安装在服务器端。如果有X11程序,很可能xauth会在那里。在不太可能的情况下,xauth安装在非标准位置,可以通过〜/ .ssh/rc(在服务器上!)调用。

请注意,您不需要在服务器上设置任何环境变量。 DISPLAY和XAUTHORITY将自动设置为正确的值。如果你运行ssh并且DISPLAY没有设置,这意味着ssh不会转发X11连接。

要确认ssh是否正在转发X11,请在ssh -v -X输出中检查包含请求X11转发的行。请注意,服务器不会以任何方式回复。

https://askubuntu.com/questions/523677/error-cannot-open-display-0-0-while-starting-remotelly-firefox

相关问题