Now we need Xvfb to accomplish this dirty task.
For Ubuntu the package is fairly straight forward just type in the command .
sudo aptitude install Xvfb
Under Fedora the same can be achieve using command .
sudo yum install xorg-x11-server-Xvfb
For more on Xvfb package check your distribution provider .
Now start the Xvfb .
Xvfb -ac :99 &
The above command start the Xvfb in background with name Display=:99 .
Now to accomplish Selenium to work under headless state we need .
- Selenium RC Server [here] .
- Selenium Client Drivers .
more on both can be found here .
Start the Selenium RC Server .
java -jar selenium-server-standalone-2.0b2.jar &
The above command basically start the Selenium-RC-Server on http://localhost:4444.
Now install selenium-webdriver [a.k.a Selenium Client Drivers] .
Note : Get your specific Selenium Client Driver based on language you prefer .
sudo gem install selenium-webdriver
Installation should work with any possible errors .
Now start your irb console .
require "rubygems" require "selenium-webdriver" s1 = Selenium::WebDriver::Remote.new :url => "http://localhost:4444/wb/pub" s1.get "http://railstech.com" s1.page_source
Wolla lah that it mission accomplish. Selenium running under headless state .
Now there are couple of handy methods I want you to know before I say enough for this post .
Suppose you need to capture ScreenShoot of the visited page by Selenium .
To achieve this all you need to do is .
Ok! that it folks enough of me now.
I will be extensively working on Xvfb and Selenium in upcoming time so except some more article on Xvfb and Selenium .
Hope that it help you in same way or other .