문제

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?

도움이 되었습니까?

해결책

Try the headless gem:

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

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top