You could trap the exception that's thrown, but that could get kind of
ugly. Especially as its probably a weird OLE exception.

It seems like we need a closed? Method on ie. It would be trivial to do
it when watir closes a window, but Im not sure I know how we would do it
if the window is closed by javasscript or a user. ( maybe something like
this.)

I don't have the code handy, so Im going off memory

Class IE  # is this the correct class
    def window_exists?
      begin   
        if <ole_object>.hWnd == -1    # I cant remember what the
variable name for the actual browser is
            return false
        end
        return true
      rescue
          return true
      end
    end
end

You could try something like this and let us know how you get on ;-)

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Chau
Sent: 16 August 2005 11:14
To: [email protected]
Subject: [Wtr-general] Detecting a closed IE



Hi,

When you open a new ie window and your homepage is blank 

require 'watir'
$ie = Watir::IE.new

you can use $ie.url=="" to detect that the blank IE is open

When you close this window ($ie.close), how can I detect that the window
is closed?

Peter

 


_______________________________________________
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

Reply via email to