error: undefined method 'document' for 31:Fixnum

152 views
Skip to first unread message

AtlantaJon

unread,
Oct 9, 2008, 4:35:34 PM10/9/08
to Watir General, brandon...@gmail.com
I have a script which can successfully reach some pages on a site but
when I use the same methods to reach pages that take a longer time to
fetch (say 9 seconds) the page will appear in the browser but Watir
execution stops because I get this error...

c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.6/./watir/ie.rb:498:in
'wait': undefined method 'document' for 31:Fixnum (NoMethodError)
from c:/ruby/lib/ruby/gems/1.38/gems/watir-1.5.6/./watir/ie.rb:496:in
'times'
from c:/ruby/lib/ruby/gems/1.38/gems/watir-1.5.6/./watir/ie.rb:496:in
'wait'
from c:/ruby/lib/ruby/gems/1.38/gems/watir-1.5.6/./watir/element.rb:
220:in 'click'

The error occurs regardless of the method used to call that page -- it
doesn't matter if I call the URL directly with:
ie.goto("https://app.fastshoppingcart.com/welcome.hg?
inWizardMode=false")
or call it off a link in the preceding web page:
ie.link(:href, "https://app.fastshoppingcart.com/welcome.hg?
inWizardMode=false").click
same error.

I get this error for any page that takes a little longer to get,
namely, because these pages are being created on the fly by the server
and have some drop-down lists populated with 500 items. They come up
maybe 9 seconds after you call them.

I thought Watir on a goto or link had a built-in wait feature that
would delay until the page did come up? Is this a special case where I
need to add other code to create an additional wait?

I'm using Ruby 1.8.6 patch 111 and Waitr 1.5.6.

Jonathan in Atlanta

Bret Pettichord

unread,
Oct 9, 2008, 6:52:08 PM10/9/08
to watir-...@googlegroups.com, brandon...@gmail.com
Jonathan,

Thank you for the very detailed report. The error is happening in the
"wait" code that is waiting for the page to load. In fact it is failing
in the code that is making sure that every document in every frame is
loaded, and I am wondering if the problem is related to their either
being lots of frames or if somehow frames are being added or removed
during load.

In any case, this change should probably prevent the problem from
happening. I have applied it to trunk, and it will be included in the
next release of Watir.

Bret

### Eclipse Workspace Patch 1.0
#P watir-all
Index: watir/lib/watir/ie.rb
===================================================================
--- watir/lib/watir/ie.rb (revision 1499)
+++ watir/lib/watir/ie.rb (working copy)
@@ -506,7 +506,7 @@
doc.frames.length.times do |n|
begin
documents_to_wait_for << doc.frames[n.to_s].document
- rescue WIN32OLERuntimeError
+ rescue WIN32OLERuntimeError, NoMethodError
end
end
rescue WIN32OLERuntimeError

My best guess is that there are multiple frames in the page, and Watir
is trying to make sure that all the

AtlantaJon

unread,
Oct 9, 2008, 8:29:56 PM10/9/08
to Watir General
Hi,
I installed FireWatir and ran same script and it executes without
errors.

There are some IFrames on the page, which is actually GoDaddy.com's
very popular Quick Shopping Cart. They have some expandable sections
on the page where text is revealed when you click on them, and that
expandable content is within IFrames. Nothing too fancy, but enough to
confuse IE Watir I guess.
Jonathan
> > Jonathan in Atlanta- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages