简体   繁体   English

使用Watir-Webdriver关闭IE时出现错误

[英]Error When closing IE using Watir-Webdriver

I have a Cucumber Test Suite that I'm running and whenever i call the browser.close method it throws the following error 我有一个正在运行的Cucumber Test Suite,每当我调用browser.close方法时,它都会引发以下错误

C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in initialize': No connection could be made because the target machine actively refused it. - connect(2) (Errno::ECONNREFUSED) from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in initialize': No connection could be made because the target machine actively refused it. - connect(2) (Errno::ECONNREFUSED) from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in initialize': No connection could be made because the target machine actively refused it. - connect(2) (Errno::ECONNREFUSED) 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.40.0/lib/selenium/webdriver/remote/http/default.rb:83:in response_for' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/http/default.rb:39:in request' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/http/common.rb:40:in call' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/bridge.rb initialize': No connection could be made because the target machine actively refused it. - connect(2) (Errno::ECONNREFUSED) from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in open'从C:/Ruby193/lib/ruby/1.9.1/ initialize': No connection could be made because the target machine actively refused it. - connect(2) (Errno::ECONNREFUSED) from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in net / http.rb:762:in block in connect' from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in / Ruby193 / lib / ruby​​ / 1.9.1 / timeout block in connect' from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in timeout'在C:/Ruby193/lib/ruby/1.9.1/中timeout' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in timeout.rb:99:in timeout' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in connect' do_start' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in开始http.rb:755:in do_start' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in开始do_start' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in开始http.rb:1284:in request' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/http/default.rb:83:in来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/http/default.rb:39:in request' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/http/common.rb:40:in call'from C:/ Ruby193 / lib / ruby​​ / gems / 1.9.1 / gems / selenium-webdriver-2.40.0 / lib / selenium / webdriver / remote / bridge.rb :634:in raw_execute' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/bridge.rb:612:in execute' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/bridge.rb:200:in quit' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/ie/bridge.rb:59:in quit' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/common/driver.rb:168:in quit' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.8/lib/watir-webdriver/browser.rb:136:in close' from D:/Workspaces/Ruby/RegressionTesting/features/support/env.rb:60:in `block in > ' :634:in raw_execute' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/bridge.rb:612:in C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/remote/bridge.rb:200:in quit' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/ie/bridge.rb:59:in quit'from C:/Ruby193/lib/ruby/gems/1.9.1 /gems/selenium-webdriver-2.40.0/lib/selenium/webdriver/common/driver.rb:168:in quit'from quit' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.8/lib/watir-webdriver/browser.rb:136:in close'from D:/Workspaces/Ruby/RegressionTesting/features/support/env.rb:60:in`block in>'

This only happens when the browser is IE. 这仅在浏览器为IE时发生。 Specifically I am testing with IE 11. This can be recreated by running the following code in IRB 具体来说,我正在使用IE 11进行测试。可以通过在IRB中运行以下代码来重新创建它。

require 'watir-webdriver'
@browser = Watir::Browser.new :ie
@browser.close

All of my test scenarios complete just fine, this only happens when I call the browser.close method in at_exit. 我所有的测试场景都可以很好地完成,只有当我在at_exit中调用browser.close方法时,才会发生这种情况。 This is just simply a nuisance... Any ideas? 这只是一个令人讨厌的事情...有什么想法吗?

I do not think Internet Explorer 11 is supported. 我不支持Internet Explorer 11。 From selenium-developers Google group : 来自硒开发者Google小组

IE 11 support continues to be blocked by changes in browser behavior. IE 11支持继续被浏览器行为更改所阻止。 Workarounds from Microsoft are unlikely to be forthcoming, due to the recent announcement of the in-process development of a Microsoft-authored driver for Internet Explorer 11 and beyond. 由于最近宣布正在开发Microsoft授权的Internet Explorer 11及更高版本驱动程序,因此Microsoft的解决方法不太可能出现。 Note that the Microsoft driver will not be available in any form until the W3C Specification for WebDriver progresses further in the spec process. 请注意,直到W3C WebDriver规范在规范过程中进一步发展之前,Microsoft驱动程序将无法以任何形式使用。 Furthermore, no timeline for release has been announced by Microsoft, nor should one be expected. 此外,Microsoft尚未发布发布时间表,也不应期望发布时间表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM