Watir loses browser connection after first goto

限于喜欢 提交于 2019-12-24 07:08:00

问题


I am completely new to Watir, trying to work out the basics so we can use it for testing our websites.

The problem is, following the 'Watir in 5 minutes' after I do my first browser.goto, I seem to lose connection to the browser window. The window is still there, but I can no longer "command" it from irb.

I just get this error:

C:\>irb
DL is deprecated, please use Fiddle
irb(main):001:0> require "watir-webdriver"
=> true
irb(main):002:0> ie = Watir::Browser.new :ie
Started InternetExplorerDriver server (32-bit)
2.32.3.0
Listening on port 5555
=> #<Watir::Browser:0x..f3e539e40 url="http://localhost:5555/" title="WebDriver"
>
irb(main):003:0> ie.goto "google.com"
=> "http://localhost:5555/"
irb(main):004:0> ie.goto "stackoverflow.com"
Selenium::WebDriver::Error::NoSuchWindowError: Unable to get browser
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.32.1/l
ib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.32.1/l
ib/selenium/webdriver/remote/response.rb:15:in `initialize'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.32.1/l
ib/selenium/webdriver/remote/http/common.rb:59:in `new'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.32.1/l
ib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.32.1/l
ib/selenium/webdriver/remote/http/default.rb:66:in `request'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.32.1/l
ib/selenium/webdriver/remote/http/common.rb:40:in `call'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.32.1/l
ib/selenium/webdriver/remote/bridge.rb:619:in `raw_execute'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.32.1/l
ib/selenium/webdriver/remote/bridge.rb:597:in `execute'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.32.1/l
ib/selenium/webdriver/remote/bridge.rb:103:in `get'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.32.1/l
ib/selenium/webdriver/common/navigation.rb:14:in `to'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.4/lib/w
atir-webdriver/browser.rb:77:in `goto'
        from (irb):4
        from C:/Ruby200-x64/bin/irb:12:in `<main>'
irb(main):005:0>

I am using Win7 x64 and Ruby x64 BUT a 32bit IE.


回答1:


Try insuring that all the sites you visit, along with your default homepage, are in the same security zone (e.g. 'trusted') and see if that makes a difference.



来源:https://stackoverflow.com/questions/16295448/watir-loses-browser-connection-after-first-goto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!