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 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,] 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, 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(
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchRemoteSession(
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchRemoteSession(
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(
at org.openqa.jetty.http.HttpContext.handle(
at org.openqa.jetty.http.HttpContext.handle(
at org.openqa.jetty.http.HttpServer.service(
at org.openqa.jetty.http.HttpConnection.service(
at org.openqa.jetty.http.HttpConnection.handleNext(
at org.openqa.jetty.http.HttpConnection.handle(
at org.openqa.jetty.http.SocketListener.handleConnection(
at org.openqa.jetty.util.ThreadedServer.handle(
at org.openqa.jetty.util.ThreadPool$
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/ 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/
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/
28-Nov-2011 11:05:53 [exec] /mnt/data/atlassian/Bamboo/xml-data/build-dir/LEGPRO-CIANT-JOB1/
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

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,


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
Community showcase
Posted Tuesday in Statuspage

Introducing Statuspage Getting Started guides! First up: What is Statuspage?

Over the next several weeks we'll be sharing some of our Getting Started guides here in the community. Throughout this series of posts, we'd love to hear from customers and non-customers ab...

201 views 4 1
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