You are not logged in.

#1 2011-07-02 06:18:12

awayand
Member
Registered: 2009-09-25
Posts: 398

selenium-server-standalone won't start firefox - a bug?

I am trying to figure out whether this is a packaging-bug or an upstream bug. Here is the symptom:

When launching selenium-server-standalone in the shell using:

$ java -jar /usr/share/selenium-server/selenium-server-standalone.jar -firefoxProfileTemplate /home/x/.mozilla/firefox/asdfas.selenium/ -log /home/x/selenium-sh.log

And then launching a little test using test.pl:

use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;

my $sel = Test::WWW::Selenium->new( host => "localhost", 
                                    port => 4444, 
                                    browser => "*chrome", 
                                    browser_url => "http://www.google.com" );

$sel->open_ok("http://www.google.com");
WAIT: {
    for (1..60) {
        if (eval { $sel->is_element_present("heythere") }) { pass; last WAIT }
        sleep(1);
    }
    fail("timeout");
}

then firefox gets started and everyone is happy. However, when I start selenium server as a daemon, firefox simply won't start up and I don't know why. Here is the scenario:

# rc.d start selenium-server

My /etc/conf.d/selenium-server.conf:

SELENIUM_SERVER_USER=x
SELENIUM_SERVER_ARGS="-firefoxProfileTemplate /home/x/.mozilla/firefox/ennhqwww.selenium -log /home/x/selenium-rc.log"

Now launching the above perl script:

$ perl test.pl

Nothing happens, it just keeps idling at "starting firefox..."

Here is the logfile selenium-rc.log:

...
14:29:09.245 DEBUG [12] org.openqa.selenium.browserlaunchers.locators.BrowserLocator - Discovering Firefox 3...
14:29:09.299 DEBUG [12] org.openqa.selenium.browserlaunchers.locators.BrowserLocator - Checking whether Firefox 3 launcher at :'/usr/lib/firefox-5.0/firefox-bin' is valid...
14:29:09.299 DEBUG [12] org.openqa.selenium.browserlaunchers.locators.BrowserLocator - Discovered valid Firefox 3 launcher  : '/usr/lib/firefox-5.0/firefox-bin'
14:29:09.301 INFO [12] org.openqa.selenium.server.BrowserSessionFactory - Allocated session 7a16510f87e24b269c72fb679be16071 for https://particulares.gruposantander.es/, launching...
14:29:09.556 DEBUG [12] org.openqa.selenium.server.browserlaunchers.ResourceExtractor - Extracting /customProfileDirCUSTFFCHROME to /tmp/customProfileDir7a16510f87e24b269c72fb679be16071
14:29:09.659 INFO [12] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Preparing Firefox profile...
14:29:11.213 INFO [12] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Launching Firefox...
14:29:11.226 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for window 'null' local frame 'null' for 1800 more secs
14:29:11.226 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for condition for 1000 more ms
14:29:12.238 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - got condition? : false
14:29:12.238 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for window 'null' local frame 'null' for 1799 more secs
14:29:12.238 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for condition for 1000 more ms
...
14:32:04.704 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - got condition? : false
14:32:04.704 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for window 'null' local frame 'null' for 1777 more secs
14:32:04.704 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for condition for 1000 more ms

It just keeps waiting for firefox. Notice I truncated the file in the middle, marked by (...) there is a good 20 seconds in there where the log just keeps showing waits. However, using the start-from-shell method above, I get the following selenium-sh.log:

14:32:18.484 DEBUG [12] org.openqa.selenium.browserlaunchers.locators.BrowserLocator - Discovering Firefox 3...
14:32:18.527 DEBUG [12] org.openqa.selenium.browserlaunchers.locators.BrowserLocator - Checking whether Firefox 3 launcher at :'/usr/lib/firefox-5.0/firefox-bin' is valid...
14:32:18.527 DEBUG [12] org.openqa.selenium.browserlaunchers.locators.BrowserLocator - Discovered valid Firefox 3 launcher  : '/usr/lib/firefox-5.0/firefox-bin'
14:32:18.528 INFO [12] org.openqa.selenium.server.BrowserSessionFactory - Allocated session 57ac24f40c0f46bd9f1166c7f81f26f5 for https://particulares.gruposantander.es/, launching...
14:32:18.797 DEBUG [12] org.openqa.selenium.server.browserlaunchers.ResourceExtractor - Extracting /customProfileDirCUSTFFCHROME to /tmp/customProfileDir57ac24f40c0f46bd9f1166c7f81f26f5
14:32:18.867 INFO [12] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Preparing Firefox profile...
14:32:22.719 INFO [12] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Launching Firefox...
14:32:22.723 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for window 'null' local frame 'null' for 1800 more secs
14:32:22.724 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for condition for 1000 more ms
14:32:23.727 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - got condition? : false
14:32:23.727 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for window 'null' local frame 'null' for 1799 more secs
14:32:23.727 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for condition for 1000 more ms
14:32:23.786 DEBUG [13] org.openqa.jetty.http.HttpConnection - new HttpConnection: Socket[addr=/0:0:0:0:0:0:0:1,port=44275,localport=4444]
14:32:23.787 DEBUG [13] org.openqa.jetty.http.HttpConnection - REQUEST from SocketListener0@0.0.0.0:4444:
GET /selenium-server/core/selenium.css HTTP/1.1
Host: localhost

Anyone got an idea why firefox won't start if selenium is started via the rc.d script, or can someone at least help me find a way to troubleshoot why this is happening (i.e. logs, strace, etc.)?

I am pretty sure it is not an upstream issue, but if you tell me it is, then I will have to file a bug there.

Thanks!

Last edited by awayand (2011-07-02 06:18:58)

Offline

#2 2011-07-03 09:36:05

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: selenium-server-standalone won't start firefox - a bug?

Under which user does the daemon run? If it is the same user under which you are able to manually start the test, it is most likely a environment problem. Otherwise it is probably permission related.

To fix a environment problem, try copying all `set` variables to the daemon's environment. For permission related, try `sudo -u daemonuser java -jar /usr/s...` and then debugging that.

Offline

Board footer

Powered by FluxBB