arvind wrote:
> I want to get the number of IE browsers open. I s it possible to get the
> number of browsers opened in watir?
>
Below is the Watir 1.5 code use in IE.attach and IE.find. It iterates
through all the IE windows to find a match. You could modify this simply
count open windows.
Bret
def self._find(how, what)
shell = WIN32OLE.new("Shell.Application")
ieTemp = nil
shell.Windows.each do |window|
next unless (window.path =~ /Internet Explorer/ rescue false)
case how
when :url
ieTemp = window if (what.matches(window.locationURL))
when :title
# normal windows explorer shells do not have document
# note window.document will fail for "new" browsers
begin
title = window.locationname
title = window.document.title
rescue WIN32OLERuntimeError
end
ieTemp = window if (what.matches(title))
when :hwnd
begin
ieTemp = window if what == window.HWND
rescue WIN32OLERuntimeError
end
else
raise ArgumentError
end
end
return ieTemp
end
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general