第一次转到后,Watir失去了浏览器连接

时间:2013-04-30 08:32:04

标签: watir watir-webdriver

我是Watir的新手,试图找出基础知识,以便我们可以用它来测试我们的网站。

问题是,在我第一次browser.goto之后,在“Watir in 5分钟”之后,我似乎失去了与浏览器窗口的连接。 窗口仍然存在,但我不能再从irb“命令”它。

我刚收到此错误:

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>

我正在使用Win7 x64和Ruby x64但是32位IE。

1 个答案:

答案 0 :(得分:2)

尝试确保您访问的所有网站以及默认主页都位于同一安全区域(例如“受信任”)并查看是否有所不同。