I will ask scripters to remove 'include Watir' from their scripts.

Can you add this resolution in release notes or somewhere?

Thanks, Bret.
Michael



----- Original Message ----
From: Bret Pettichord <[EMAIL PROTECTED]>
To: watir-general@googlegroups.com
Sent: Friday, November 7, 2008 10:44:12 AM
Subject: [wtr-general] Re: Possible issues with 1.6.1


Ok, here are some solutions.

1. Don't put "include Watir" at toplevel. I've argued many times before 
that this is a bad idea. I think that almost every one who does this 
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. Sorry for the shouting, but 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.

OK, 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.

If you really want to still use "include Watir" there are two other 
workarounds:

2. Move the "include Watir" statement to the specific class where you 
need it (e.g. your test case class). This is actually a perfectly 
reasonable use of this command.

3. Add a "require 'watir/ie'" to your script after "require 'watir'"

Bret

Bret Pettichord wrote:
> I've reproduced the issue. Thanks
>
> Michael Hwee wrote:
>  
>> I guess I spoke too soon.
>>
>> Bret, this is how you reproduce it.
>>
>> Some old scripts have "include Watir" which is the culprit.
>>
>> require 'watir'
>> include Watir
>>
>> Can you take a look?
>>
>> Thanks
>> Michael
>>
>>
>>
>> ----- Original Message ----
>> From: Michael Hwee <[EMAIL PROTECTED]>
>> To: watir-general@googlegroups.com
>> Sent: Friday, November 7, 2008 9:06:00 AM
>> Subject: [wtr-general] Re: Possible issues with 1.6.1
>>
>>
>>
>> This is strange.
>> I didn't get this anymore after running a short simple script first.
>> I guess I have no idea how that happens.
>>
>> Consider to be solved by itself -- not likely to happen most of the time 
>> though :)
>>
>> Michael
>>
>>
>>
>> ----- Original Message ----
>> From: Bret Pettichord <[EMAIL PROTECTED]>
>> To: watir-general@googlegroups.com
>> Sent: Thursday, November 6, 2008 12:18:25 PM
>> Subject: [wtr-general] Re: Possible issues with 1.6.1
>>
>>
>> Can you give me more information about the context for this error?
>>
>> MHwee wrote:
>>  
>>    
>>> I got different from 1.6.1.
>>>
>>> e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/
>>> core_ext/m
>>> odule/introspection.rb:57:in `const_get': no such file to load --
>>> safariwatir (M
>>> issingSourceFile)
>>>         from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>> active_suppo
>>> rt/core_ext/module/introspection.rb:57:in `local_constants'
>>>         from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>> active_suppo
>>> rt/core_ext/module/introspection.rb:57:in `each'
>>>         from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>> active_suppo
>>> rt/core_ext/module/introspection.rb:57:in `local_constants'
>>>         from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>> active_suppo
>>> rt/core_ext/module/introspection.rb:55:in `each'
>>>         from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>> active_suppo
>>> rt/core_ext/module/introspection.rb:55:in `local_constants'
>>>         from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>> active_suppo
>>> rt/core_ext/module/introspection.rb:73:in `local_constant_names'
>>>         from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>> active_suppo
>>> rt/dependencies.rb:334:in `new_constants_in'
>>>         from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>> active_suppo
>>> rt/dependencies.rb:331:in `collect'
>>>         from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>> active_suppo
>>> rt/dependencies.rb:331:in `new_constants_in'
>>>         from e:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>> active_suppo
>>> rt/dependencies.rb:510:in `require'
>>>         from e:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:55
>>>         from e:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:213:in `[]'
>>>         from e:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:213:in `run'
>>>         from e:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
>>>         from e:/ruby/lib/ruby/1.8/test/unit.rb:278
>>>
>>>
>>>
>>> On Nov 5, 7:01 am, Bret Pettichord <[EMAIL PROTECTED]> wrote:
>>>  
>>>    
>>>      
>>>> Arkie wrote:
>>>>    
>>>>      
>>>>        
>>>>> Env:
>>>>> - WinXp
>>>>> - Ruby 1.8.6
>>>>> - Watir 1.6.1
>>>>>      
>>>>> This was a clean install of Ruby and Watir.  All previous version of
>>>>> Ruby/watir were previously uninstalled.
>>>>>      
>>>>> 1)
>>>>> I had to register the autoitx3.dll by hand.
>>>>> I remembered that the install of the gem took care of this
>>>>> automatically?
>>>>>      
>>>>>        
>>>>>          
>>>> Actually this is registered not on installation, but on first use --
>>>> assuming you have admin privileges. Nothing has changed with this since
>>>> 1.5, but this is an important point nonetheless. Thanks for the report.> 2)
>>>>    
>>>>      
>>>>        
>>>>> Firing up irb, taking the following steps returns an error saying that
>>>>> I'm missing some safari files.
>>>>>      
>>>>> Commenting out the relevant lines for safari support (lines 11 & 12 in
>>>>> commonwatir\Browsers.rb) moves me along, but this might be useful for
>>>>> some, or maybe I'm just missing something.
>>>>>      
>>>>>        
>>>>>          
>>>> OK. this is really interesting. I'll have to figure out why this is
>>>> happening. Not good.
>>>>
>>>>
>>>>
>>>>    
>>>>      
>>>>        
>>>>> irb(main):001:0> require 'watir'
>>>>> => true
>>>>> irb(main):002:0> include Watir
>>>>> => Object
>>>>> irb(main):003:0> require 'watir/WindowHelper'
>>>>> MissingSourceFile: no such file to load --safariwatir
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/core_ext/module/introspection.rb:57:i
>>>>> n `const_get'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/core_ext/module/introspection.rb:57:i
>>>>> n `local_constants'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/core_ext/module/introspection.rb:57:i
>>>>> n `each'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/core_ext/module/introspection.rb:57:i
>>>>> n `local_constants'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/core_ext/module/introspection.rb:55:i
>>>>> n `each'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/core_ext/module/introspection.rb:55:i
>>>>> n `local_constants'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/core_ext/module/introspection.rb:73:i
>>>>> n `local_constant_names'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/dependencies.rb:334:in `new_constants
>>>>> _in'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/dependencies.rb:331:in `collect'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/dependencies.rb:331:in `new_constants
>>>>> _in'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support/dependencies.rb:510:in `require'
>>>>>         from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/
>>>>> active_support.rb:40
>>>>>         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.1/lib/watir/
>>>>> non_control_elements.rb:1
>>>>>         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.1/lib/watir/
>>>>> ie.rb:82
>>>>>         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.1/lib/watir/
>>>>> WindowHelper.rb:2
>>>>>         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 (irb):3irb(main):004:0> exit
>>>>>      
>>>>>        
>>>>>          
>>>  
>>>    
>>>      
>>
>>
>>    
>>  
>>    
>
>
> >
>  



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to