Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium Server on startup

I'm using Selenium RC in a Ubuntu system. I want to automate the tests, and I need to start Selenium-server.jar on startup of the machine.

I created seleniumServer.conf in /ect/init/ with:

start on startup
start on runlevel 3

respawn

exec xvfb-run java -jar /home/condde/selenium-server-1.0.3/selenium-server.jar -port 4444

When I reboot the machine, it works fine, the process is running. But when I execute a test, the result is:

PHPUnit_Framework_Exception: Could not connect to the Selenium RC server.

Any ideas? Thanks!

like image 710
condde Avatar asked Nov 20 '25 21:11

condde


1 Answers

I have the same problem, my process can not connect the selenium server sometimes. After dig into debug log and selenium source code, I found that's because java's SecureRandom hangs if /dev/random hangs when selenium try generate random number. So I replace /dev/random with /dev/urandom, then selenium server works fine:

sudo mv /dev/random /dev/random.real
sudo ln -s /dev/urandom /dev/random

Or you can modify $JAVA_HOME/jre/lib/security/java.security file and changing the property:

securerandom.source=file:/dev/random

to:

securerandom.source=file:/dev/urandom

Maybe it works, but not for me.

like image 65
Xie Yanbo Avatar answered Nov 24 '25 22:11

Xie Yanbo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!