From: Joel Pearson Date: 2013-03-22T17:50:31+09:00 Subject: Re: question on watir Works for me: __________________________________________ irb(main):001:0> require 'watir-webdriver' => true irb(main):002:0> b = Watir::Browser.new => # irb(main):003:0> b.goto 'google.com' => "http://www.google.co.uk/" #Here I manually opened a new window from that session. irb(main):004:0> b.windows.count => 2 irb(main):005:0> b.windows.each do |w| irb(main):006:1* puts w.title irb(main):007:1> end Google Gmail: Email from Google => [#, #] irb(main):008:0> b.windows.each do |w| irb(main):009:1* w.close irb(main):010:1> end => [#, #] #All Windows closed! __________________________________________ Perhaps there's some Javascript code preventing the window from closing until you've made a selection. In which case you'll need to interact with the window before closing it. The same principle applies, you just transfer control to the popup until you're done with it. When you use this: $browser.windows.last.use do The variable "$browser" will refer to the last window (or whichever one you choose in that line) until it reaches "end". It should just be a matter of interacting with the selected window in the same way as you normally would. -- Posted via http://www.ruby-forum.com/.