Ruby on rails Watir Webdriver-协议不支持地址系列-套接字(2)

Ruby on rails Watir Webdriver-协议不支持地址系列-套接字(2),ruby-on-rails,ruby,watir,watir-webdriver,centos6,Ruby On Rails,Ruby,Watir,Watir Webdriver,Centos6,我使用watirwebdriver/MiniTest框架已经不到一个月了,进展非常顺利。然而,每次新构建启动时我都需要运行的包包含不到100个单独的测试,这些测试需要一个多小时才能完成 这就是为什么我在Centos-6-x8664上使用Ruby、RVM、Watir、Rails和Firefox设置VPS。这样,我就不必在笔记本电脑上运行脚本并等待它们完成,然后再做其他事情 但是,当我尝试使用irb测试watir是否工作时,我得到以下错误: Errno::EAFNOSUPPORT: Address

我使用watirwebdriver/MiniTest框架已经不到一个月了,进展非常顺利。然而,每次新构建启动时我都需要运行的包包含不到100个单独的测试,这些测试需要一个多小时才能完成

这就是为什么我在Centos-6-x8664上使用Ruby、RVM、Watir、Rails和Firefox设置VPS。这样,我就不必在笔记本电脑上运行脚本并等待它们完成,然后再做其他事情

但是,当我尝试使用irb测试watir是否工作时,我得到以下错误:

 Errno::EAFNOSUPPORT: Address family not supported by protocol - socket(2)
测试:


有什么想法吗?

工作中有人设法解决了这个问题。他说,

They try to connect twice
first to 127.0.0.1 port 7055
then too ::1 port 7055
second one fails
::1 is localhost of IPv6
so you seem to be connecting localhost
and in your server look at /etc/hosts
localhost resolves to the ::1

所以你所要做的就是编辑你的/etc/hosts文件并注释掉::1,或者如果你想删除它

,这样你就不想在你的vps上启动firefox了?这应该是无头运行吗?我按照指南在VPS上安装firefox,这只是为了说明它的工作原理。我真的希望运行Chrome和IE。是的,这必须是无头的。
require "watir-webdriver"
require 'watir-webdriver'
require 'headless'
headless = Headless.new
headless.start

browser = Watir::Browser.new :ff
browser.goto "http://remove-url-for-this-post.com" 
puts ("Starting SearchValSelectFields")
browser.select_list(:id, "edit-select-sector").select("Finance and Accounting")
sleep (5)
browser.select_list(:id, "edit-select-subsector--3").select("All Sub-sector")
browser.select_list(:id, "edit-select-location").select("Singapore")
browser.button(:value,"Search").click
assert(browser.text.include?("Salary and employment forecast"))
browser.screenshots ('..\screenshots\SearchValSelectFields.png')
browser.select_list(:id, "edit-select-sector").select("Select Sector")
sleep(3)
browser.select_list(:id, "edit-select-subsector--2").select("Select Sub-sector")
sleep(3)
browser.select_list(:id, "edit-select-location").select("Select Location")
sleep(3)
browser.button(:value,"Search").click
assert(browser.text.include?("This field is required"))
browser.close
headless.destroy
They try to connect twice
first to 127.0.0.1 port 7055
then too ::1 port 7055
second one fails
::1 is localhost of IPv6
so you seem to be connecting localhost
and in your server look at /etc/hosts
localhost resolves to the ::1