I'm using Watir to automate the testing of a report generated by MS
SQL Reporting Services.  The report generates 4 pages of output.  Each
page except the last one has a table which is addressable with Watir
as follows:

        tbl = ie.frame(:id,'ReportFramectl144').frame
(:id,'report').table(:class,'a3 r3')

For whatever reason, the final page is addressed differently.  It is:

        tbl = ie.frame(:id,'ReportFramectl144').frame
(:id,'report').table(:class,'a3')

So in order to handle this situation I placed the following 'begin -
rescue - end' block inside a loop which is executed for each page of
the output:

    begin
        tbl = ie.frame(:id,'ReportFramectl144').frame
(:id,'report').table(:class,'a3 r3')
        puts "A3 R3"
    rescue
        tbl = ie.frame(:id,'ReportFramectl144').frame
(:id,'report').table(:class,'a3')
        puts "A3"
    end

My expectation is that any exception generated by the 'a3 r3'
definition of tbl should cause the 'a3' definition of tbl to be
executed.  However, this is not happening.  When the 'a3 r3' exception
raises an exception, the script does not execute the rescue clause,
nor does it skip the final execution of 'puts "A3 R3".  The complete
output, run within Scite, is as follows:

   >ruby wt_no_policy_claims_list_spec.rb
   A3 R3
   A3 R3
   A3 R3
   A3 R3
   F

   1)
   Watir::Exception::UnknownObjectException in 'Wt No Policy Claims
List No Policy Claims'
   Unable to locate element, using :class, "a3 r3"
   wt_no_policy_claims_list_spec.rb:42:
   wt_no_policy_claims_list_spec.rb:26:in `loop'
   wt_no_policy_claims_list_spec.rb:26:
   wt_no_policy_claims_list_spec.rb:8:

   Finished in 7.032 seconds

   1 example, 1 failure

So 'rescue' doesn't seem to be working as advertised, at least as I
understand it.  Any wisdom would be much appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general

Reply via email to