[Wtr-general] display errors without exiting the script?
bret at pettichord.com
Sat Jun 23 12:08:26 EDT 2007
> i have a link in $ie wich opens me a new window
> i attach that window to a variable $ie1 like that: $ie1=IE.attach(:title, /bla bla bla/) and i must verify if that window really exist or not
> how do i do that because if that window exist is ok, but if is not exist the script is interrupted and stoped and i dont want that: c:/ruby/lib/ruby/gems/1.8/gems/watir-188.8.131.522/./watir.rb:1642:in `attach_browser_window': Unable to locate a window with title of (?-mix:bla bla bla) (Watir::Exception::NoMatchingWindowFoundException)
Instead of "attach" use the "find" method -- it will return false (not
raise an exception) if it cannot find a window with the specified name.
$ie1 = IE.find(:title, /blah/)
print 'window not found' unless $ie1
More information about the Wtr-general