From: Joel Pearson Date: 2013-03-23T01:12:03+09:00 Subject: Re: question on watir This is how it works if you have 2 IE windows open: ______________________ do... Watir::Browser.attach( :index, 0 ) #Grab the first window puts .title #Output the window title loop #Onward to index 1! Watir::Browser.attach( :index, 1 ) #Grab the second window puts .title #Output the window title loop #Sally forth to index 2! Watir::Browser.attach( :index, 2 ) #Oh no, there's no 3rd window! rescue #Catch the error caused by not finding a window break #Exit the loop end ______________________ And that's how it works. It's not an ideal solution as you will get a delay before timing out on grabbing the non-existent upper indexed window, but given that you don't know how many windows are open, that's the best I could come up with on short notice. -- Posted via http://www.ruby-forum.com/.