Friday, November 21, 2008

Issues and resolutions with Watir 1.6.2

Issue 1 :

If we have 'require 'watir/contrib/enabled_popup'" in test script, then the below error would be shown.

c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/contrib/ enabled_popup.rb:5: uninitialized constant Watir::PageContainer::Win32 (NameError) 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'

Resolution from watir Development Team :

require 'watir/ie' after 'require watir'. Watir team has added the require statement to the enabled popup script itself, so this workaround will not be required with the next version of watir

Issue 2:

If we have 'include Watir' in your test script the below error may be shown when running test.
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/core_ext/module/introspection.rb:57:in `const_get': no such file to load -- safariwatir (MissingSourceFile)

Resolution from watir Development Team :

Remove 'include Watir' from their scripts. Almost every one who use 'include watir'does so out of confusion. They think that it is like "include" in Perl or "import" in Java, but it isn't. Specifically, Java's import is a naming convenience that affects the current file. Ruby's include is a naming conventience that affects the current file AND EVERY OTHER RUBY FILE. what it actually does it take everything in the Watir module and add them to the base object that is used by every other Ruby class, module and library. It is much, much worse than using global variables.
End of rant. In this case it is running into a conflict with the activesupport package, which Watir recently started using to help simplify our code base.