Question

I'm trying for the first time to use Watir for automated browser-based testing. For all browsers I'm interested in testing with (Firefox, Chrome), I encounter timeout errors trying to connect.

Here's what I'm trying, with the errors I get in comments:

require "rubygems"
require "watir-webdriver"

browser = Watir::Browser.new :ff

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

browser = Watir::Browser.new :chrome

# Selenium::WebDriver::Error::WebDriverError:
# unable to connect to chromedriver http://127.0.0.1:56602 

System/environment details:

  • Ubuntu desktop 11.04
  • Apache2 running on same host but only listening to port 80
  • gem selenium-webdriver version is 2.17.0
  • ruby version is 1.8.7

I'm guessing I'm doing something fundamentally wrong but I don't know enough to know where to start investigating what may be wrong. All I am aware of is that nothing is running on the ports that Selenium is trying to connect to.

What is needed for this to work?

Was it helpful?

Solution

Try the headless gem:

require 'rubygems'
require 'watir-webdriver'
require 'headless'

Headless.ly do
  browser = Watir::Browser.new :ff
end

OTHER TIPS

Also, on RedHat based systems, the Xvfb binary is called "Xvfb". Make a link called "xvfb" so that the headless gem finds it.

$ ln -s /usr/bin/Xvfb /usr/local/bin/xvfb

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top