[Wtr-general] Random Watir script failures
Paul Carvalho
tester.paul at gmail.com
Thu Mar 9 10:58:41 EST 2006
On 09/03/06, Bret Pettichord <bret at pettichord.com> wrote:
>
>
> I think the problem is that row_data[42] is nil. Are you sure it is
> initialized? The error message means that you are using "+" on something
> that is nil. It is not a Watir error.
>
Hee hee, oops. I removed two pages from the array and missed updating these
lines. It was the last two pages in the script that kept failing. Makes
sense. Now I know what that error means. Thanks.
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.)
>
>
> It helps if you can provide a stack so we know what line the problem is
> occuring. Different Watir objects use this call (outerHTML), but you haven't
> provided enough information to know which one is failing.
>
>
> > 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.
>
>
> This error means there is no MainWindow frame. Watir should probably be
> raising an UnknownFrameException here instead.
>
> You can probably work around this problem thus:
>
> if $ie.frame("MainWindow").exists?
> $ie.frame("MainWindow").button(:name, /CancelButton/).click
> else
> raise, "MainWindow frame not found"
> end
>
> But in the end this only changes how the error message looks. The problem
> is that the frame isn't there.
>
>
I think that both of these errors are manifestations of the same problem -
the frame isn't there, yet.
I asked our developers about this and it turns out that with Dot-Net, IE
sometimes reports that it is done before it is finished drawing all the
frames. (I had even reported some bugs in our app about this a while ago -
the delay can be up to several, noticeable seconds sometimes.)
So on some pages, it makes sense that I have to insert a sleep/wait command
of some sort. I'll finish the script and then think about refactoring it to
include checks like the one above to make it smarter about waiting for
certain pages to appear before proceeding.
That really helped. Thanks.
Paul.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060309/32d418e1/attachment.html
More information about the Wtr-general
mailing list