12

I am trying to setup a linux box (no display connected) to run as a selenium server. If I connect a monitor and login on the box then I can run the selenium tests no problem. If I try to run the tests via ssh then the tests fail with

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:360)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:114)

I think it has something to do with the display's absence / presence. Any ideas?

PS the browser is firefox 5, the OS is Ubuntu 11.04

Dimitris
  • 2,501
  • 3
  • 21
  • 28
  • without connecting the monitor, are you manually able to open a firefox browser in that machine using ssh? – A.J Aug 18 '11 at 20:33

3 Answers3

14

I got it to work by using xvfb. So first install xvfb:

sudo apt-get install xvfb

then run it

Xvfb :99 -ac

and then start the selenium server

DISPLAY=:99 java -jar selenium-server-standalone-2.4.0.jar
xk0der
  • 3,660
  • 4
  • 26
  • 35
Dimitris
  • 2,501
  • 3
  • 21
  • 28
3

Here is my answer.

You get this error because there is no monitor to open firefox on, it is getting confused.

Install Xvfb, which pretends to be a monitor, but doesn't show up anywhere.
sudo apt-get install xvfb

If you want less errors add these fonts, but those warning aren't important.
sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic

Then start it running and set your display to something the system won't use. Here is what I do, remeber the & makes the terminal run something in the background.
Xvfb :99 -ac &
export DISPLAY=:99
firefox &

Also I was having problems with a ruby on rails server disconnecting when I quit the ssh terminal. To fix that problem use Screen. Screen runs another terminal without being affected by the ssh.
sudo apt-get install screen

Then just start screen before you you do the stuff above.
screen

To get out of the current screen window just click "Ctrl + A" and to get back in type screen -r.

Community
  • 1
  • 1
mvndaai
  • 3,453
  • 3
  • 30
  • 34
0

There is a good way to test using imagemagick screen shoot

Install mozilla firefox headless(no GUI)

yum install xorg-x11-server-Xvfb.x86_64 xfonts-base xfonts-75dpi xfonts-100dpi firefox ImageMagick.x86_64

Starts firefox on virtual gui

DISPLAY=:1 firefox http://google.com &

– test and check

Xvfb :1 -screen 1 1024x768x24 &
ps -ef |grep firefox

Uses imagemagic to get a printscreen, to make sure its working. DISPLAY=:1 import -window root google.com.png

(Optional) Set proxy in firefox profile

vi /root/.mozilla/firefox/ns11i9xo.default/prefs.js
user_pref(“network.proxy.http”, “proxyserver”);
user_pref(“network.proxy.http_port”, 8080);
user_pref(“network.proxy.no_proxies_on”, “localhost, 127.0.0.1, 172.17.0.0/16, 10.5.0.0/16″);

http://felipeferreira.net/?p=1220

Xoroz
  • 427
  • 4
  • 3