问题
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