当hosts文件重定向localhost时,Watir-WebDriver将无法工作

时间:2012-06-04 12:59:05

标签: ruby testing watir watir-webdriver

你好我使用的是Windows 7,我希望使用带有ruby 1.9.2的watir-webdriver。请告诉我为什么我得到这个:

C:\>irb

irb(main):001:0> require "watir-webdriver"

=> true

irb(main):002:0> browser = Watir::Browser.new :ff

Errno::EADDRNOTAVAIL: ??dany adres jest nieprawid?owy w tym kontek?cie. - bind(2
)
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s
elenium/webdriver/firefox/socket_lock.rb:45:in `initialize'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s
elenium/webdriver/firefox/socket_lock.rb:45:in `new'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s
elenium/webdriver/firefox/socket_lock.rb:45:in `can_lock?'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s
elenium/webdriver/firefox/socket_lock.rb:31:in `lock'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s
elenium/webdriver/firefox/socket_lock.rb:17:in `locked'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s
elenium/webdriver/firefox/launcher.rb:32:in `launch'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s
elenium/webdriver/firefox/bridge.rb:19:in `initialize'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s
elenium/webdriver/common/driver.rb:31:in `new'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/lib/s
elenium/webdriver/common/driver.rb:31:in `for'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.0/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 (irb):2:in `new'
        from (irb):2
        from C:/Ruby193/bin/irb:12:in `<main>'
irb(main):003:0>

非常感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

您很可能拥有一个将localhost重定向到其他东西的主机条目。

删除该条目,事情应该可以正常工作。