Hi there, I've got more of a Ruby question than a Watir one, so I hope you don't mind if I post it here first.<br><br>I am in the process of rewriting my first Ruby/Watir scripts from a year ago - a site-map walkthrough script to collect some simple Performance metrics. When I first wrote the script, I used the Test/Unit (Class/Test) structure because that was the only way I knew how to structure scripts at that time. (
i.e. used the Watir examples as a guide.)<br><br>A year later, I now know how to structure my scripts in a more regular Ruby script fashion so I updated my walkthrough script. I used a neat trick in my old script to recover from a script error (
e.g. assertion failure) and continue on but I seem to be having some problems doing the same thing with the Ruby script format. I was wondering if someone can offer any advice to help me figure this out.<br><br>Here's what I've got so far:
<br><br>## Main script snippet:<br> ...<br> # open the IE browser<br> $ie = IE.new<br> <br> # A) Walk the Public Pages. => Need to Trap this so the "something_went_wrong" variable works correctly<br> page_set_to_check( walk_Public_Pages )
<br><br>----<br><br># Here's the page_set_to_check() method:<br><br>module site_walkabout_methods<br><br> def page_set_to_check( page_set )<br> begin<br> page_set<br> rescue => e<br> $something_went_wrong = 'Yes'
<br> end<br> write_status<br> end<br><br>end<br>----<br><br>So, the "walk_Public_Pages" routine gets called, but if there's an assertion failure in it (e.g. because of an incorrect link name), the "rescue => e" part of page_set_to_check() doesn't run like I would expect it to. In fact, the whole script terminates at this point!
<br><br>Please let me know if you have any helpful suggestions to get the script to auto-recover and continue.<br><br>Thanks. Paul C.<br><br><br>