Cannot start browser for selenium via ssh

I am trying to configure linux box (without connecting to the display) to run as a selenium server. If I connect the monitor and enter the box, then I can run selenium tests without problems. If I try to run the tests via ssh, then the tests fail

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 this has something to do with the absence / presence of the display. Any ideas?

PS browser - firefox 5, OS - Ubuntu 11.04

+8
firefox ubuntu selenium
source share
3 answers

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

 sudo apt-get install xvfb 

then run it

 Xvfb :99 -ac 

and then start selenium server

 DISPLAY=:99 java -jar selenium-server-standalone-2.4.0.jar 
+10
source share

Here is my answer .

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

Install Xvfb, which pretends to be a monitor, but is not displayed anywhere.
sudo apt-get install xvfb

If you want fewer errors to add these fonts, this warning does not matter.
sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic

Then run it and set something on the screen that the system will not use. Here is what I am doing, remember that & causes the terminal to run something in the background.
Xvfb :99 -ac &
export DISPLAY=:99
firefox &

Also, I had problems with ruby ​​when I disconnected the rails server when I left the ssh terminal. To fix this problem, use the Screen. The screen starts another terminal without ssh influence.
sudo apt-get install screen

Then just launch the screen before you make the material higher.
screen

To exit the current screen window, simply press "Ctrl + A" and return to the -r screen.

0
source share

There is a good way to check using imagemagick screen capture

Install mozilla firefox without a head (no GUI)

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

Runs firefox on virtual gui

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

- check and check

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

Uses imagemagic to get a printed screen to make sure it works. DISPLAY =: 1 import -window root google.com.png

(optional) Install a proxy server in your 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

0
source share

All Articles