只需一个简单的脚本来自动化一个 firefox 浏览器:只需一个简单的脚本来自动化一个 firefox 浏览器:
require 'rubygems'
require 'watir-webdriver'
# Initialize watir firefox browser
$browser = Watir::Browser.new :ff , :profile => 'default'
导致以下我无法弄清楚的错误。是否有 TCP 端口被阻止或其他原因?。顺便说一句,我正在使用我的办公室电脑,代码在我的家用电脑上运行良好。
C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `initialize': getaddrinfo: No such
host is known. (SocketError)
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `open'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `connect'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1284:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/http/default.rb:76:in `response_for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/http/default.rb:38:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/http/common.rb:40:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/bridge.rb:598:in `raw_execute'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/bridge.rb:92:in `create_session'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/firefox/bridge.rb:28:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/common/driver.rb:31:in `new'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/common/driver.rb:31:in `for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver.rb:65:in `for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.1/lib/watir
-webdriver/browser.rb:35:in `initialize'
from sic_class.rb:8:in `new'
from sic_class.rb:8:in `<main>'
没有代理,我使用的是 windows 7,watir webdriver 0.6.1 和 firefox 13.01