2014-03-06 70 views
3

現在,Safari默認支持,我沒有嘗試編譯我自己的Safari webdriver。windows上的Safari瀏覽器不支持watir-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

我很抱歉讓你知道,但我認爲你不能在Windows上驅動Safari。那麼,這不是一個大驚喜。當前版本的Mac OS爲Safari爲7.0.2,最新支持的Windows版本爲5.1.7,所以Selenium無法駕馭它並不令人感到意外。欲瞭解更多信息,請看https://github.com/watir/watirbook/blob/master/installation/windows.md#safari

+0

非常感謝。沒有wi會停止在Windows上嘗試它。有時間得到一臺Mac。 :d – Navin