wait_until ...

57 views
Skip to first unread message

Mark Lehky

unread,
Mar 19, 2009, 2:12:14 PM3/19/09
to watir-...@googlegroups.com
Hi all.

I am still very much at the start of using Watir. Just found the
wait_until{} here
<http://wiki.openqa.org/display/WTR/FAQ#FAQ-HowdoIdealwithtimingissuesandnotusesleep%3F>
which would be very useful for me. Replicating the supplied code
snippet (added the missing dot) it fails!

First error:
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:70:in
`const_get': no such file to load -- safariwatir (MissingSourceFile)
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:70:in
`local_constants'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:70:in
`each'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:70:in
`local_constants'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:68:in
`each'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:68:in
`local_constants'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:86:in
`local_constant_names'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:498:in
`new_constants_in'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:495:in
`collect'
... 6 levels...
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie.rb:82
from Test_Login-Logout_Thrash.rb:22

My Test_Login-Logout_Thrash.rb:22 is:
$ie = Watir::IE.start(location)

I can fix this by removing the
include Watir
from the code snippet, but then I get:

Test_Login-Logout_Thrash.rb:44: undefined method `wait_until' for
main:Object (NoMethodError)
from Test_Login-Logout_Thrash.rb:24:in `each'
from Test_Login-Logout_Thrash.rb:24

Any ideas what other secrets I am missing?

ANu Gangavaram

unread,
Mar 19, 2009, 2:19:15 PM3/19/09
to watir-...@googlegroups.com
You would first want to add the below statement in your script:
 
require 'Watir'
Also, your error mentions safariwatir - Are you working on IE or Safari... you might want to check that as well.

ANu Gangavaram

unread,
Mar 19, 2009, 2:39:02 PM3/19/09
to watir-...@googlegroups.com
You might also want to add something like : Watir::Waiter.wait_until{$browser.div(:class, 'home_top').exists?}
 
Hope this works for you.

Mark Lehky

unread,
Mar 19, 2009, 2:44:02 PM3/19/09
to watir-...@googlegroups.com
I have absolutely no idea how Safari got into all this? I am running
this against IE. But even after your suggestion, I get the same error.
Just out of curiosity is Ruby case-sensitive in the require statement:
require "watir"
require "Watir"

Thanx.

2009/3/19 ANu Gangavaram <anuw...@gmail.com>:

Mark Lehky

unread,
Mar 19, 2009, 2:48:37 PM3/19/09
to watir-...@googlegroups.com
However, this does work. Thanx :)
Could someone more knowledgeable than I fix the wiki that I mentioned
below, so the example actually works? For the benefit of future
generations to come.

2009/3/19 ANu Gangavaram <anuw...@gmail.com>:

ANu Gangavaram

unread,
Mar 19, 2009, 2:50:56 PM3/19/09
to watir-...@googlegroups.com
No, its not case-sensitive, but try the second suggestion Watir::Waiter.wait_until instead of wait_until:
 
Watir::Waiter.wait_until{$browser.div(:class, 'home_top').exists?}

Mark Lehky

unread,
Mar 19, 2009, 3:00:47 PM3/19/09
to watir-...@googlegroups.com
Yes this does work!
Is it possible that in the example (see wiki link below) "include
Watir" should actually be "include Waiter"?

2009/3/19 ANu Gangavaram <anuw...@gmail.com>:

Bret Pettichord

unread,
Mar 19, 2009, 6:43:35 PM3/19/09
to watir-...@googlegroups.com
1. require *is* case-sensitive. if you do "require 'Watir'" it will
*work*, but you will also get warnings (eventually).

2. remove the include statement. that is causing your safariwatir problem.

3. i have updated the wiki page. let me know if still see any problems
with it.

bret
--
Bret Pettichord
CTO, WatirCraft LLC, www.watircraft.com
Lead Developer, Watir, www.watir.com
Blog, www.io.com/~wazmo/blog
Twitter, www.twitter.com/bpettichord

Watir Training: Austin March 25-26, Portland/Beaverton April 16-17
www.watircraft.com/training

Reply all
Reply to author
Forward
0 new messages