How to use selenium with nagios_server
1. 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 &
— 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
— (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,,,”);
2. Using
— start headless linux
Xvfb :1 -ac -noreset -screen 1 1024x768x24 &
–start Selenium Server in bg
export DISPLATY=1 && nohup java -jar /usr/local/nagios/libexec/check_selenium/selenium-server-standalone-2.24.1.jar -Dhttp.proxyHost= -Dhttp.proxyPort=8080 -debug -log /tmp/selenium.log -browserSessionReuse -trustAllSSLCertificates &
–Run the tests
edit the with the data_dir -s -w 40 -c 60 -d

Load Firefox profile
DISPLAY=:1 && nohup java -jar selenium-server-standalone-2.24.1.jar -Dhttp.proxyHost= -Dhttp.proxyPort=8080 -firefoxProfileTemplate /root/.mozilla/firefox/ns11i9xo.default/
If you have an error like Non-ASCII character.
Set the enconding inside the .py file will solve the problem, check
If it gets stuck on Launching Firefox…
When calling the selenium-server you must pass the complete path into it like /usr/local/selenium-server…
Firefox has problem recovering windows and tabs
Reinstall firefox
yum -y -v remove firefox && yum -y -v install firefox
Details on how to correctly start the Selenium Server standalone
java -jar selenium-server-standalone-2.24.1.jar -h
How to install pip python-pip
curl -O
Using using the script but It did not work
1. Compile Selenium Testcase to JUnit
–Download the check_selenium
wget “”
–Download selenium-server.jar (2.24.1) July 2012
wge “”
–Install a java compiler
yum install java-1.6.0-openjdk-devel.x86_64
–Complile it, should generate a .class files
javac -cp ./junit-4.8.1.jar:./selenium-server.jar
–Start the Selenium server and leave it on the BG
nohup java -jar selenium-server.jar &
–Make sure its there, it should liste on port 4444 by default
ps -ef |grep selenium && netstat -anp |grep “:4444”
–Following the instrucions on README
“On your Nagis host extract the check_selenium.tar.gz file into your libexec path. Adjust the java home in the file. As the Selenium IDE puts the Java classes automatically in the package com.tests.examples, create a directory com/tests/examples on your filesystem. Put the compiled Java file into this directory.”

Tags: , , ,

1 thought on “How to use selenium with nagios

  1. I have tried above but I could not find three packages xfonts-base xfonts-75dpi xfonts-100dpi.
    can you please help me to findout repository for the same.

Leave a Reply

Your email address will not be published. Required fields are marked *