0

I am executing selenium test cases from Jenkins. I want to run UI testcases also. But the browser is not launching when Jenkins is build. I am Using Cent OS and FireFox. Path is specified as follows.

Stacktrace

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

Please provide me a solution?

iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
rParvathi
  • 1,939
  • 2
  • 16
  • 21
  • 1
    Please supply Jenkins log (with trace and full stack trace) so we can see what the problem is. – Andrew Regan Feb 05 '16 at 13:42
  • If the tests expect UI, you need to consider some tools to provide a "DISPLAY". xvnc for example. https://wiki.jenkins-ci.org/display/JENKINS/Xvnc+Plugin. Before we go there, please provide details about the error you see. – Jayan Feb 06 '16 at 16:19
  • The above error is what I found in my stack trace when I build the Jenkins. I need to run this in background and list out the result set. – rParvathi Feb 08 '16 at 09:51
  • Possible duplicate of [Does Selenium support headless browser testing?](http://stackoverflow.com/questions/7568899/does-selenium-support-headless-browser-testing) – Greg Burghardt Oct 10 '16 at 16:55

1 Answers1

-1

X11 forwarding needs to be enabled on both the client side and the server side.

On the client side, the -X (capital X) option to ssh enables X11 forwarding, and you can make this the default (for all connections or for a specific conection) with ForwardX11 yes in ~/.ssh/config.

On the server side, X11Forwarding yes must specified in /etc/ssh/sshd_config. Note that the default is no forwarding (some distributions turn it on in their default /etc/ssh/sshd_config), and that the user cannot override this setting.

The xauth program must be installed on the server side. If there are any X11 programs there, it's very likely that xauth will be there. In the unlikely case xauth was installed in a nonstandard location, it can be called through ~/.ssh/rc (on the server!).

Note that you do not need to set any environment variables on the server. DISPLAY and XAUTHORITY will automatically be set to their proper values. If you run ssh and DISPLAY is not set, it means ssh is not forwarding the X11 connection.

To confirm that ssh is forwarding X11, check for a line containing Requesting X11 forwarding in the ssh -v -X output. Note that the server won't reply either way.

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

Community
  • 1
  • 1
Sethu_P
  • 100
  • 4