Selenium - Selenium::WebDriver::Error::WebDriverError

Selenium automates browsers which is used to do web-applicaiton testing in browser. I was having project in rails where I need to use selenium for testing web applicaiton mainly to test behaviour of javascript. I am using Ubuntu OS for development. By default selenium is using fireforx browser in linux. 

When I started testing I was having starnge error from selenium that looks like this :

'connect_until_stable': unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)(Selenium::WebDriver::Error::WebDriverError)*

Its mainly because selenium get NULL value from DISPLAY environment variable in my system. DISPLAY environement variable is used to indicate to graphical applications where to display the actual graphical user interface. DISPLAY environment variable needs three parameters to set which looks like :

 host-name followed by a colon (:), a display number followed by a dot (.) and a screen number. i.e. export DISPLAY=:0.0

If we ommit to write host name, it means we are running on localhost. 

So for my problem, I set this environement varaible to 0 i.e. export DISPLAY=:0 and it starts working. For more convenient, I was setting this variable in my configuration file in ruby like this : ENV["DISPLAY"] = ":0" which was working fine and sets DISPLAY variable when I start testing.

Hope that helps!!!