Hi there, I have noticed that a script of mine seems to be having random failures that I can't explain.

I am running Watir 1.4.1 on Ruby 184-16 on Windows XP Pro SP2.

The script I'm working with walks through our site map - it enters a page, gets the page size, download time, leaves and then moves onto the next page.  The script is correct.

However, at random intervals when I run it, a button or link will fail to get recognised and the script just stops.  I've been trying to get around the failures by adding a "sleep 1" (or 2 or 3 seconds) whenever it fails.  This latest run, it wasn't even a button that the script failed on -- it was a + operator!  Okay, I know that I don't know any workaround for that one!

Here was the error output:
----
  1) Error:
test_d_Reports(TC_LD_site_map_walkthru):
NoMethodError: undefined method `+' for nil:NilClass
    LD_site_map_walkthrough.rb:461:in `test_d_Reports'
----

and line 461 is:

      row_data[42] = row_data[42]  + ',' + $ie.frame('MainWindow').html.length.to_s + ',' + $ie.down_load_time.to_s

I know there's nothing wrong with this line because it looks relatively identical to a billion other lines in the script - just the array number changes.  And it works when I run it the next time.

Other errors I've seen include:
----
  1) Error:
test_d_Reports(TC_LD_site_map_walkthru):
NoMethodError: undefined method `outerHTML' for nil:NilClass
----
(for the same 'row_data' kind of line as above, just elsewhere in the script.)

and errors like the following when I remove strategically inserted "sleep" lines:
----
 1) Error:
test_d_Reports(TC_LD_site_map_walkthru):
NoMethodError: undefined method `all' for nil:NilClass
    c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:754:in `getContainerContents'
    c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:778:in `getObject'
    c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3063:in `initialize'
    c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:304:in `button'
    LD_site_map_walkthrough.rb:312:in `test_d_Reports'
----

for line 312: $ie.frame('MainWindow').button(:name, /CancelButton/).click

Is this something that there is a workaround for?  If I had to guess, it looks like the script is trying to continue before the page itself finishes loading in IE.

Please help.

Paul.

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

Reply via email to