I've been working on setting up Selenium Grid2 in the cloud and I'm now getting an error that I cannot figure out.
Selenium::WebDriver::Error::UnknownError: Unable to connect to host 127.0.0.1 on port 7057 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
I've started two nodes - Hub and WebDriver
java -jar selenium-server-standalone-2.32.0.jar -role hub -port 7055
java -jar selenium-server-standalone-2.32.0.jar -role webdriver -hub http://ec2-54-244-219-84.us-west-2.compute.amazonaws.com:7055/grid/register
I've installed Xvfb and I've started a screen using.
Xvfb :99 -screen 0 1024x768x24 &
I've also set the display environment variable.
export DISPLAY=:99
I'm trying to run a simple test on Amazon EC2.
require 'headless'
require 'selenium-webdriver'
# Start the headless browser
headless = Headless.new
headless.start
browser = Selenium::WebDriver.for(:remote, :url => "http://localhost:7055/wd/hub")
# Print google.com's title
browser.get('http://google.com')
puts browser.title
# Close the browser
browser.quit
headless.destroy
Or from my local machine
require 'headless'
require 'selenium-webdriver'
# Start the headless browser
headless = Headless.new
headless.start
browser = Selenium::WebDriver.for(:remote, :url => "http://ec2-54-244-205-27.us-west-2.compute.amazonaws.com:7055/wd/hub")
# Print google.com's title
browser.get('http://google.com')
puts browser.title
# Close the browser
browser.quit
headless.destroy
But I still get the above error...
Error: no display specified
Also, when I try to run FireFox from Command Line...
Xlib: extension "RANDR" missing on display ":99".
What solved this issue for me was doing the following...
Instead of running the webdriver node like this...
java -jar selenium-server-standalone-2.32.0.jar -role webdriver -hub http://ec2-54-244-219-84.us-west-2.compute.amazonaws.com:7055/grid/register
I added xvfb-run before the command...
xvfb-run java -jar selenium-server-standalone-2.32.0.jar -role webdriver -hub http://ec2-54-244-219-84.us-west-2.compute.amazonaws.com:7055/grid/register