Windows上的Safari无法使用watir-webdriver

时间:2014-03-06 01:07:44

标签: ruby selenium-webdriver watir-webdriver safariwatir

现在默认支持Safari,我没有尝试编译自己的Safari webdriver。

我在Windows 8.1上下载并安装了Safari 5.1.7。

我安装了最新版本的watir-webdriver和selenium-webdriver。

当我尝试@browser = Watir::Browser.new(:safari)时,会启动Safari浏览器,但我会抛出异常。

irb(main):003:0> @browser = Watir::Browser.new(:safari)
Errno::ECONNABORTED: An established connection was aborted by the software in your host machine.
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/safari/server.rb:37:in `read_nonblock'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/safari/server.rb:37:in `receive'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/safari/bridge.rb:68:in `raw_execute'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/safari/bridge.rb:48:in `create_session'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/safari/bridge.rb:27:in `initialize'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/common/driver.rb:47:in `new'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/common/driver.rb:47:in `for'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver.rb:67:in `for'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.8/lib/watir-webdriver/browser.rb:46:in `initialize'
        from (irb):3:in `new'
        from (irb):3
        from C:/Ruby193/bin/irb:12:in `'

我可以在浏览器中看到以下内容。

SafariDriver客户端

[  0.009s] [safaridriver.client] Requesting connection at ws://127.0.0.1:65407/wd...
[  0.026s] [safaridriver.client] Request acknowledged; connecting...

请告诉我如何解决此问题。

1 个答案:

答案 0 :(得分:1)

我很遗憾成为让你知道的人,但我认为你无法在Windows上驾驶Safari。嗯,这不是一个大惊喜。 Mac OS的当前版本Safari为7.0.2,Windows的最新支持版本为5.1.7,因此Selenium在驱动它时遇到问题并不奇怪。有关详细信息,请查看https://github.com/watir/watirbook/blob/master/installation/windows.md#safari