John Lolis wrote:
> waitr 1136
>
> Lets say I have the following action i want to perform
>
> $ie.frame('Frame').table(:id,'ID).table(:index,1)[1][2].click
>
> But, the this is frame heavy page, and wait sometimes doesn't play nice, so I 
> decide to do
>
> element = $ie.frame('Frame').table(:id,'ID).table(:index,1)
> wait_until(30) { element.exists? }
> element[1][2].click
>
> In my mind the above says, "keep looking for element until it exists, if it 
> doesn't fail". What happens though is .exists? throws an exception when it 
> can't find the element making the whole thing not work.
>   
> It seems that exists should never throw an exception, it should always be 
> true or false. Yes its there or no its not.
>
> In watir.rb I think this is the offending code
>     # Returns whether this element actually exists.
>     def exists?
>       begin
>         locate if defined?(locate)
>      rescue WIN32OLERuntimeError
>         @o = nil
>       end
>       @o ? true: false
>     end
>     alias :exist? :exists?
>
> The rescue doesn't seem to be broad enough. Lower down the stack trace i 
> notice that asset_exists is doing the following
>
> unless ole_object
> raise UnknownObjectException.new("Unable to locate object, using [EMAIL 
> PROTECTED] and [EMAIL PROTECTED]")
> end
>
> which exists can't handle. If in exists i make the rescue a 'catch all' 
> everything works like a champ (but i'm not sure what effects that has on the 
> system).
>
> Hope that made sense.
>   
Excellent report and analysis. I think I agree that this is a bug and 
that it needs to be fixed along the lines that you suggest.

Bret
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to