Bamboo-Selenium RC-Xvfb intregation on headless server

Hi Folks,

I'm in the process of integrating Selenium RC and Xvfb with Bamboo. I can succesfully run firefox on the command line using Xvfb's virtual display, launching www.example.com and capturing a screen shot. However, Selenium hangs when trying to create a new browser session.

If you can understand the problem based on the logs below, great. If not, I would appreciate suggestions for resources to check. Thanks so much!

Selenium log excerpt:

11:05:33.816 INFO [12] org.openqa.selenium.server.SeleniumDriverResourceHandler - Command request: getNewBrowserSession[*firefox /usr/lib/iceweasel/firefox-bin, https://revenuewire.cc/] on session null
11:05:33.816 INFO [12] org.openqa.selenium.server.BrowserSessionFactory - creating new remote session
11:05:33.817 DEBUG [12] org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory - Requested browser string '*firefox /usr/lib/iceweasel/firefox-bin' matches *firefox
11:05:33.817 INFO [12] org.openqa.selenium.server.BrowserSessionFactory - Allocated session 7280ce26d52c4875ba246a8ce8a47a9a for https://revenuewire.cc/, launching...
11:05:33.817 DEBUG [12] org.openqa.selenium.server.browserlaunchers.ResourceExtractor - Extracting /customProfileDirCUSTFFCHROME to /tmp/customProfileDir7280ce26d52c4875ba246a8ce8a47a9a
11:05:33.840 INFO [12] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Preparing Firefox profile...
11:05:53.865 ERROR [12] org.openqa.selenium.server.BrowserSessionFactory - Failed to start new browser session, shutdown browser and clear all session data
java.lang.RuntimeException: Timed out waiting for profile to be created!
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:364)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:120)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:90)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchRemoteSession(FirefoxChromeLauncher.java:416)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchRemoteSession(FirefoxLauncher.java:118)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:374)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:125)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:86)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:809)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:435)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:405)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:149)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
11:05:53.868 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - clearing queue set
11:05:53.868 INFO [12] org.openqa.selenium.server.SeleniumDriverResourceHandler - Got result: Failed to start new browser session: Error while launching browser on session null
11:05:53.868 DEBUG [12] org.openqa.jetty.http.HttpContext - Handled by org.openqa.selenium.server.SeleniumDriverResourceHandler in HttpContext[/selenium-server,/selenium-server]
11:05:53.868 DEBUG [12] org.openqa.jetty.http.HttpConnection - RESPONSE:
HTTP/1.1 200 OK
Date: Mon, 28 Nov 2011 19:05:33 GMT
Server: Jetty/5.1.x (Linux/2.6.35.14-revenuewire amd64 java/1.6.0_26
Cache-Control: no-cache
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Content-Length: 66

Bamboo log excerpt:

28-Nov-2011 11:05:33 selenium:
28-Nov-2011 11:05:33 [exec] PHPUnit 3.6.3 by Sebastian Bergmann.
28-Nov-2011 11:05:33 [exec]
28-Nov-2011 11:05:33 [exec] Configuration read from /mnt/data/atlassian/Bamboo/xml-data/build-dir/LEGPRO-CIANT-JOB1/test-suite.revenuewire.com/Bamboo/selenium_config.xml
28-Nov-2011 11:05:33 [exec]
28-Nov-2011 11:05:53 [exec] E
28-Nov-2011 11:05:53 [exec]
28-Nov-2011 11:05:53 [exec] Time: 20 seconds, Memory: 6.00Mb
28-Nov-2011 11:05:53 [exec]
28-Nov-2011 11:05:53 [exec] There was 1 error:
28-Nov-2011 11:05:53 [exec]
28-Nov-2011 11:05:53 [exec] 1) Example::testMyTestCase
28-Nov-2011 11:05:53 [exec] PHPUnit_Framework_Exception: Result is neither "true" nor "false": 'OR Server Exception: sessionId led to start new browser session: Error while launching browser doesn't exist; perhaps this session was already stopped?'
28-Nov-2011 11:05:53 [exec]
28-Nov-2011 11:05:53 [exec] /mnt/data/atlassian/Bamboo/xml-data/build-dir/LEGPRO-CIANT-JOB1/test-suite.revenuewire.com/selenium/PHPUnit/LoginFirefoxTest.php:24
28-Nov-2011 11:05:53 [exec] /mnt/data/atlassian/Bamboo/xml-data/build-dir/LEGPRO-CIANT-JOB1/test-suite.revenuewire.com/selenium/PHPUnit/LoginFirefoxTest.php:24
28-Nov-2011 11:05:53 [exec] /usr/bin/phpunit:44
28-Nov-2011 11:05:53 [exec]
28-Nov-2011 11:05:53 [exec] FAILURES!
28-Nov-2011 11:05:53 [exec] Tests: 1, Assertions: 0, Errors: 1.
28-Nov-2011 11:05:53 [exec]
28-Nov-2011 11:05:53 [exec] Writing code coverage data to XML file, this may take a moment.
28-Nov-2011 11:05:53 [exec]
28-Nov-2011 11:05:53 [exec] Generating code coverage report, this may take a moment.
28-Nov-2011 11:05:53 [exec] Result: 2

1 answer

This widget could not be displayed.

How are you launching xvfb and Firefox? Is it a script or are you using different Tasks (one to launch xvfb and one to launch Firefox?).

Hi James. Thanks for taking the time.

Xvfb is being launched manually by user A prior to running the bamboo build. The build is then trigerred and executes under user B. During the build, firefox is launched by Selenium.

My suspicion is that this problem is strictly down to selenium. When run from the command line Firefox gives a pretty explicit error when no display is detected, and this error seems entirely different - it hangs when interacting with firefox's profile manager. Other people have had this problem, but none of the root causes apply to me:

-Unsupported version of firefox doesn't apply, as the config files in my version of Selenium list 10.0 as the max version

-I call the firefox binary directly, as Selenium prefers

-Selenium can correctly locate Firefox's application.ini

Hi David,

I m facing a similar problem, and I was wondering if you, or James found a solution for the problem you disscussed about.

During my build, firefox is launched by Selenium, Right? I found out that the elastic instance that has been built uses firefox 23.0.1 and Selenium 2.35.0.

When I run my plan, the error I get in my log is

15-May-2014 16:06:19 1) TesteGoogle::testSave
15-May-2014 16:06:19 UnhandledWebDriverError:
15-May-2014 16:06:19
15-May-2014 16:06:19 /mnt/bamboo-ebs/bamboo-agent/build-dir/SYS-CI-JOB1/Library/php-webdriver-master/lib/WebDriverExceptions.php:61
15-May-2014 16:06:19 /mnt/bamboo-ebs/bamboo-agent/build-dir/SYS-CI-JOB1/Library/php-webdriver-master/lib/remote/HttpCommandExecutor.php:246
15-May-2014 16:06:19 /mnt/bamboo-ebs/bamboo-agent/build-dir/SYS-CI-JOB1/Library/php-webdriver-master/lib/remote/HttpCommandExecutor.php:147
15-May-2014 16:06:19 /mnt/bamboo-ebs/bamboo-agent/build-dir/SYS-CI-JOB1/Library/php-webdriver-master/lib/remote/RemoteWebDriver.php:33
15-May-2014 16:06:19 /mnt/bamboo-ebs/bamboo-agent/build-dir/SYS-CI-JOB1/Test/TesteGoogle.php:17
15-May-2014 16:06:19
15-May-2014 16:06:19 FAILURES!
15-May-2014 16:06:19 Tests: 1, Assertions: 0, Errors: 1.

Can you give me some tips... to debug and find this error!!!!!

Thank you in advance,

Luciana


By the way... on that file, line 17... that s what I ve got:

$this->driver = new RemoteWebDriver($host, $capabilities);

Wich has been built with:

// the endpoint of the Selenium Standalone Server

$host = 'http://localhost:4444/wd/hub'; // this is the default

// edit the capability, choose firefox as the browser

$capabilities = array(WebDriverCapabilityType::BROWSER_NAME => 'firefox');

Works fine in my machine.. but my selenium version is newer and so my firefox version!

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

121 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you