My code is based on that code. It's the attach call that fails when the browser is pointed at an invalid page.
Thanks, Richard -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dara Lillis Sent: Wednesday, January 25, 2006 10:01 AM To: [email protected] Subject: Re: [Wtr-general] close all IE windows I'm not sure if this will solve your problem, but I posted some code to the Wiki FAQ (http://watir.net/FAQ#Closing_all_open_IE_windows) a while ago to close all open IE windows: # close all open ie windows all_closed = 'unknown' while (all_closed != 'yes') begin #use a regexp that will match any title so all ie windows are forced closed header = Regexp.new(//) @ie = IE.attach(:title, header) @ie.close # catch the exception raised when there's now window to attach to. rescue NoMatchingWindowFoundException all_closed = 'yes' end end -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Bolton Sent: Tuesday, January 24, 2006 2:26 PM To: [email protected] Subject: Re: [Wtr-general] close all IE windows Get the developer to fix his bug? ---Michael B. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Lawrence Sent: January 24, 2006 1:49 PM To: [email protected] Subject: Re: [Wtr-general] close all IE windows It's not that. It's an address like "http://localhost:1505/Web" (the local address of the VS web server on a developer's machine) that a developer left in a smoke test instead of switching to the correct address for the build server. But since nothing is listening on 1505 on the build server, the attach call fails, and I'm left with an orphan IE window. Richard -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Atilla Ozgur Sent: Tuesday, January 24, 2006 10:25 AM To: [email protected] Subject: Re: [Wtr-general] close all IE windows Problem is IE is also works as File Explorer. Attach code does not work with file explorer behaviour. If your IE with invalid web address is a file explorer window you can not do that. As I understand from error, it may not be possible to do that On 1/24/06, Richard Lawrence <[EMAIL PROTECTED]> wrote: > I've added a rescue block to deal with the exception, but that doesn't > help me attach to windows that currently have an invalid web address. > Effectively, what I'm looking for is a way to call attach without it > calling wait internally. Is that possible somehow? > > Thanks, > > Richard > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Zeljko Filipin > Sent: Tuesday, January 24, 2006 8:21 AM > To: [email protected] > Subject: Re: [Wtr-general] close all IE windows > > I think this will help. > > begin > # attach to and close all IE windows > rescue > end > > I think that Bret Pettichord posted code that does what you need, but > I can not find it now. > > Zeljko > > 2006/1/24, Richard Lawrence <[EMAIL PROTECTED]>: > > > > > > > > I'm trying to attach to and close all IE windows before and after my > tests > > to ensure that there are no orphan IE windows. However, if there is an > error > > in one of the open windows (due to an invalid address, for example), > the > > attach calls fails like this: > > > > Watir::Exception::NavigationException: Cannot find server or DNS > > Error > > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1160:in > > `check_for_http_error' > > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1141:in > > `set_defaults' > > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1135:in `call' > > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1436:in > > `run_error_checks' > > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1435:in `each' > > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1435:in > > `run_error_checks' > > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1419:in `wait' > > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1113:in > > `attach_init' > > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1104:in > > `attach' > > > > > > > > Is there a way I can disable error checking on these attach calls? I > don't > > care if the content of the window is good; I just want to close it. > > > > > > > > Thanks, > > > > > > > > Richard > > > > ____________________________________________ > > Richard Lawrence | Senior Solution Developer, MCSD.NET > > Avanade(r) Inc | Rocky Mountain District, US West Region > > Mobile: 303.895.7688 > > www.avanade.com > > > > > > _______________________________________________ > > Wtr-general mailing list > > [email protected] > > http://rubyforge.org/mailman/listinfo/wtr-general > > > > > > > -- > http://iskusivac.blog.hr/ > > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
