3
我一直在使用watir-webdriver/MiniTest框架,並且它一直非常順利。然而,每次啓動新版本時,我需要運行的包含100多個單獨測試,這需要花費一個多小時才能完成所有這些測試。Watir-Webdriver - 協議不支持的地址系列 - 套接字(2)
這就是爲什麼我在Centos-6-x86_64上安裝帶有Ruby,RVM,Watir,Rails和Firefox的VPS。這樣我就不必在我的筆記本電腦上運行這些腳本,並在我能做任何事情之前等待它們完成。
然而,當我試圖測試的Watir使用IRB工作,我得到以下錯誤:
Errno::EAFNOSUPPORT: Address family not supported by protocol - socket(2)
測試:
[[email protected] ~]# irb
1.9.3p448 :001 > require 'watir-webdriver'
=> true
1.9.3p448 :002 > b = Watir::Browser.start 'www.google.com'
Errno::EAFNOSUPPORT: Address family not supported by protocol - socket(2)
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/common/port_prober.rb:28:in `initialize'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/common/port_prober.rb:28:in `new'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/common/port_prober.rb:28:in `block in free?'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/common/port_prober.rb:26:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/common/port_prober.rb:26:in `free?'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/common/port_prober.rb:5:in `above'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/firefox/launcher.rb:49:in `find_free_port'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/firefox/launcher.rb:33:in `block in launch'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/firefox/socket_lock.rb:20:in `locked'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/firefox/launcher.rb:32:in `launch'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/firefox/bridge.rb:24:in `initialize'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/common/driver.rb:31:in `new'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver/common/driver.rb:31:in `for'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/ lib/selenium/webdriver.rb:67:in `for'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/watir-webdriver-0.6.4/lib/ watir- webdriver/browser.rb:46:in `initialize'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/watir-webdriver-0.6.4/lib/ watir- webdriver/browser.rb:29:in `new'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/watir-webdriver-0.6.4/lib/ watir- webdriver/browser.rb:29:in `start'
from (irb):2
from /usr/local/rvm/rubies/ruby-1.9.3-p448/bin/irb:13:in `<main>'1.9.3p4 1.9.3p448 :003 >
我一直在研究這個錯誤,我發現很多網站聲稱它是通過禁用ipv6來修復的,而我仍然遇到這個錯誤。
不知道這是否有差別,但我也有nginx的/ PHP/MySQL安裝上這個VPS
編輯 - 紅寶石文件下面貼
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
任何想法?
所以你wan't推出的Firefox在您的VPS ?那應該是無頭的? – phoet
我按照指南在VPS上安裝了Firefox,這只是爲了展示它的工作原理。我實際上喜歡Chrome和IE。是的,這將不得不是無頭的。 – CustomNet