Help with Hudson Seleniumhq plugin

132 views
Skip to first unread message

scott hardegree

unread,
Dec 8, 2014, 6:59:22 PM12/8/14
to jenkins...@googlegroups.com
Hello All,

I am struggling with trying to run a simple test case via the selenium plugin headlessly with Xvfb.  The web application is hosted on a RedHat 5 server in a QA type environment.  Firefox is the current ESR version.  I have verified that Xvfb is started, and every time I try to kick off a test I am presented with the below:

(The way I am starting the selenium standalone server on the application server is: sudo java -jar /path/to/jar/file/on/app/server/selenium-server.jar -debug -htmlSuite "*firefox" http://mysiteonport:8080 "/path/to/test/on/app/server/RESTATQA_LOGIN.html" "%WORKSPACE%/results.html")  I am unable to start the selenium server without sudo (is this a clue?)


Building in workspace /var/lib/jenkins/jobs/myjenkinsjob/workspace
[workspace] $ /bin/sh -xe /tmp/hudson3706563076225771773.sh
+ java -jar selenium-server.jar -debug -htmlSuite '*firefox' http://myserveronport:8080 /home/myuser/LOGIN.html %WORKSPACE%/results.html
18:22:18.190 INFO - Launching a standalone server
18:22:18.244 INFO - Java: Sun Microsystems Inc. 20.6-b01
18:22:18.245 INFO - OS: Linux 2.6.18-308.20.1.el5 amd64
18:22:18.266 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
18:22:18.266 INFO - Selenium server running in debug mode.
18:22:18.305 DEBUG - add component: SocketL...@0.0.0.0:4444
18:22:18.322 DEBUG - add component: org.openqa.jetty.http.ResourceCache@670655dd
18:22:18.329 DEBUG - add component: org.openqa.selenium.server.ProxyHandler in HttpContext[/,/]
18:22:18.330 DEBUG - add component: HttpContext[/,/]
18:22:18.332 DEBUG - Added HttpContext[/,/] for host *
18:22:18.332 DEBUG - add component: org.openqa.jetty.http.ResourceCache@29edc073
18:22:18.334 DEBUG - added SC{BASIC,null,user,CONFIDENTIAL} at /org/openqa/selenium/tests/html/basicAuth/*
18:22:18.343 DEBUG - add component: org.openqa.jetty.http.handler.SecurityHandler in HttpContext[/selenium-server,/selenium-server]
18:22:18.346 DEBUG - add component: org.openqa.selenium.server.StaticContentHandler in HttpContext[/selenium-server,/selenium-server]
18:22:18.348 DEBUG - add component: org.openqa.selenium.server.SessionExtensionJsHandler in HttpContext[/selenium-server,/selenium-server]
18:22:18.350 DEBUG - add component: org.openqa.selenium.server.htmlrunner.SingleTestSuiteResourceHandler in HttpContext[/selenium-server,/selenium-server]
18:22:18.351 DEBUG - add component: org.openqa.selenium.server.htmlrunner.SeleniumHTMLRunnerResultsHandler@78ce5b1c
18:22:18.351 DEBUG - add component: HttpContext[/selenium-server,/selenium-server]
18:22:18.352 DEBUG - Added HttpContext[/selenium-server,/selenium-server] for host *
18:22:18.388 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: LINUX
18:22:18.421 DEBUG - add component: org.openqa.jetty.http.ResourceCache@77827284
18:22:18.439 DEBUG - add component: org.openqa.selenium.server.SeleniumDriverResourceHandler in HttpContext[/selenium-server,/selenium-server]
18:22:18.439 DEBUG - add component: HttpContext[/selenium-server/driver,/selenium-server/driver]
18:22:18.439 DEBUG - Added HttpContext[/selenium-server/driver,/selenium-server/driver] for host *
18:22:18.439 DEBUG - add component: org.openqa.jetty.http.ResourceCache@10382a9
18:22:18.456 DEBUG - add component: WebDriver remote server
18:22:18.461 DEBUG - add component: org.openqa.jetty.jetty.servlet.HashSessionManager@2d04faf8
18:22:18.461 DEBUG - add component: org.openqa.jetty.jetty.servlet.ServletHandler@21f8c6df
18:22:18.469 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
18:22:18.469 DEBUG - add component: HttpContext[/wd,/wd]
18:22:18.469 DEBUG - Added HttpContext[/wd,/wd] for host *
18:22:18.470 DEBUG - Starting org.openqa.jetty.jetty.Server@defb836
18:22:18.471 INFO - Version Jetty/5.1.x
18:22:18.471 DEBUG - LISTENERS: [SocketL...@0.0.0.0:4444]
18:22:18.471 DEBUG - HANDLER: {null={/selenium-server/driver/*=[HttpContext[/selenium-server/driver,/selenium-server/driver]], /selenium-server/*=[HttpContext[/selenium-server,/selenium-server]], /=[HttpContext[/,/]], /wd/*=[HttpContext[/wd,/wd]]}}
18:22:18.472 DEBUG - Starting HttpContext[/selenium-server/driver,/selenium-server/driver]
18:22:18.472 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@138d107f for HttpContext[/selenium-server/driver,/selenium-server/driver]
18:22:18.472 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
18:22:18.473 DEBUG - Starting HttpContext[/selenium-server,/selenium-server]
18:22:18.473 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@138d107f for HttpContext[/selenium-server,/selenium-server]
18:22:18.474 DEBUG - Started org.openqa.jetty.http.handler.SecurityHandler in HttpContext[/selenium-server,/selenium-server]
18:22:18.474 DEBUG - Started org.openqa.selenium.server.StaticContentHandler in HttpContext[/selenium-server,/selenium-server]
18:22:18.474 DEBUG - Started org.openqa.selenium.server.SessionExtensionJsHandler in HttpContext[/selenium-server,/selenium-server]
18:22:18.474 DEBUG - Started org.openqa.selenium.server.htmlrunner.SingleTestSuiteResourceHandler in HttpContext[/selenium-server,/selenium-server]
18:22:18.474 DEBUG - Started org.openqa.selenium.server.SeleniumDriverResourceHandler in HttpContext[/selenium-server,/selenium-server]
18:22:18.474 INFO - Started HttpContext[/selenium-server,/selenium-server]
18:22:18.475 DEBUG - Starting HttpContext[/,/]
18:22:18.475 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@138d107f for HttpContext[/,/]
18:22:18.475 DEBUG - Started org.openqa.selenium.server.ProxyHandler in HttpContext[/,/]
18:22:18.475 INFO - Started HttpContext[/,/]
18:22:18.475 DEBUG - Starting HttpContext[/wd,/wd]
18:22:18.475 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@138d107f for HttpContext[/wd,/wd]
18:22:18.475 DEBUG - Starting org.openqa.jetty.jetty.servlet.ServletHandler@21f8c6df
18:22:18.476 DEBUG - New random session seed
18:22:18.507 DEBUG - Started holder of class org.openqa.selenium.remote.server.DriverServlet
18:22:18.508 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@21f8c6df
18:22:18.508 INFO - Started HttpContext[/wd,/wd]
18:22:18.513 DEBUG - Session scavenger period = 30s
18:22:18.513 INFO - Started SocketListener on 0.0.0.0:4444
18:22:18.513 INFO - Started org.openqa.jetty.jetty.Server@defb836
18:22:18.532 DEBUG - Requested browser string '*firefox' matches *firefox 
jar:file:/path/to/jenkins/jobs/myjobname/workspace/selenium-server.jar!/customProfileDirCUSTFFCHROME
18:22:18.555 DEBUG - Extracting /customProfileDirCUSTFFCHROME to /tmp/customProfileDir938518
18:22:18.639 INFO - Preparing Firefox profile...
HTML suite exception seen:
java.lang.RuntimeException: Timed out waiting for profile to be created!
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:304)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:116)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:86)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchHTMLSuite(FirefoxChromeLauncher.java:336)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchHTMLSuite(FirefoxLauncher.java:98)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:146)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:198)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:640)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:305)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:97)
18:22:50.831 INFO - Shutting down...
18:22:50.832 DEBUG - Stopping org.openqa.jetty.jetty.Server@defb836
18:22:50.832 DEBUG - closing ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]
Build step 'Execute shell' marked build as failure
Publishing Selenium report...
Finished: FAILURE

The configurations that I have tried
1. creating a different firefox profile and adding that to my shell command
2. adding the xvfb plugin to jenkins
3. executing both commands via the server and jenkins job
4. verifying that firefox is installed on the server and is the current ESR version AND verified that it is compatibility with selenium by checking the following link http://docs.seleniumhq.org/about/platforms.jsp
5. adding a global variable in jenkins name=DISPLAY value=:99
6. verifying permissions are correctly set on the .jar file, the test *.html file, and the results.html to the best of my knowledge.
7. verifying that I am able to open my site on the server

Has anyone experienced a similar problem and have a fix for it?

Thanks in advanced! 

Ankush Aggarwal

unread,
Dec 9, 2014, 1:10:43 AM12/9/14
to jenkins...@googlegroups.com
Hi Scott,

to run command without sudo. 
1) login to server with root user 
2) run command visudo
3) search for this "root    ALL=(ALL)       ALL"
3) add following line below <your username> ALL=(ALL)       ALL

I have add "export DISPLAY=:99" (please exclude double quotes) in /etc/init.d/jenkins script and restart jenkins. xvfb prcess should be started with user with which you are logged in. Eg. if you are logged in with jenkins users and xvfb process should be started with same user.
I am using Firefox 32 version and selenium-server-2.44.0.jar and its working fine for me.

I didnt face exactly same issue but i faced Firefox and selenium server versions compatibility issue. I would suggest to check if your selenium jar support FF version or not.

Thanks,
Ankush

scott hardegree

unread,
Dec 9, 2014, 9:53:19 AM12/9/14
to jenkins...@googlegroups.com
THANKS ANKUSH!  I'll give this a try and post the results!

scott hardegree

unread,
Dec 9, 2014, 1:55:46 PM12/9/14
to jenkins...@googlegroups.com
I've gotten a little further thanks to you.  It was user related after all.  I was able to launch Xvfb and firefox via a Jenkins job.  However, I came up against the following over and over again:

11:35:53.726 DEBUG - REQUEST from SocketL...@0.0.0.0:4444:
GET /selenium-server/core/selenium-test.css HTTP/1.1
Host: localhost:4444
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Firefox/31.0
Accept: text/css,*/*;q=0.1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive


11:35:53.726 DEBUG - Try HttpContext[/selenium-server,/selenium-server],0
11:35:53.726 DEBUG - RestishHandler org.openqa.jetty.http.handler.SecurityHandler in HttpContext[/selenium-server,/selenium-server]
11:35:53.726 DEBUG - RestishHandler org.openqa.selenium.server.StaticContentHandler in HttpContext[/selenium-server,/selenium-server]
11:35:53.727 DEBUG - PATH=/core/selenium-test.css RESOURCE=/core/selenium-test.css
11:35:53.728 DEBUG - Looking for /core/selenium-test.css
11:35:53.729 DEBUG - Handled by org.openqa.selenium.server.StaticContentHandler in HttpContext[/selenium-server,/selenium-server]
11:35:53.729 DEBUG - RESPONSE:
HTTP/1.1 200 OK
Date: Tue, 09 Dec 2014 16:35:53 GMT
Server: Jetty/5.1.x (Linux/2.6.18-308.20.1.el5 amd64 java/1.6.0_31
Cache-Control: no-cache
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/css
Content-Length: 557
Last-Modified: Wed, 09 Dec 2015 16:35:53 GMT
Accept-Ranges: bytes


11:36:50.411 INFO - Killing Firefox...
11:36:50.436 DEBUG - EOFException()
11:36:50.438 DEBUG - EOFException()
11:36:50.438 DEBUG - EOFException()
11:36:50.438 DEBUG - EOFException()
11:36:50.439 DEBUG - EOFException()
11:36:50.439 DEBUG - EOFException()
HTML suite exception seen:
org.openqa.selenium.server.SeleniumCommandTimedOutException
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:155)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:198)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:640)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:305)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:97)
11:36:50.482 INFO - Shutting down...
11:36:50.483 DEBUG - Stopping org.openqa.jetty.jetty.Server@6f507fb2
11:36:50.483 DEBUG - closing ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]
11:36:50.484 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]
Xvfb stopping
Publishing Selenium report...
ERROR: No Test Report Found
Build step 'Publish Selenium Report' changed build result to FAILURE
Finished: FAILURE

Some things I've done:
1. I was forced to set the selenium value -timeout 60 due to the job getting stuck a SocketTimeOutException which does not show up in the debug logs if I set this value.
2. I have done some Internet searches and have a couple of things I will try, such as re-saving the test case.

However, you got me further than I would have on my own, THANKS AGAIN.

Scott...
Reply all
Reply to author
Forward
0 new messages