I apologize in advance for not being any kind of programmer and asking such
unintelligent questions.  We have a huge suite of Watir tests, most of which
were written by a former coworker.  It's a huge investment which we are
trying to maintain.  I realize that Watir isn't intended for use by people
who aren't Ruby programmers (and believe me, I've been working hard for more
than a year to learn Ruby in my vast amounts of spare time).  But I'm hoping
some of you nice and helpful people might be able to give me a direction to
go in.

We have customers using IE7 so we wanted to start testing there.  I asked
our sys admin for a PC with IE7 on it.  Our sys admin didn't have a Windows
XP license, but he did have a Vista license, so he built a machine with
Vista.  I haven't been able to get the Watir tests working there at all,
although Watir does work in irb.

I've installed Watir 1.5.1 (using the gem), copied the win32ole.so as
directed, changed the title bar text for the modal dialog in
WinClicker.rband in our code to say "Windows Internet Explorer", and
am on to different
problems with Vista / IE7 than I started out with.  In fact I'm not getting
as far as I was before with Watir 1.4.1.

Just about all our scripts include a login.rb module which contains an
include for a mixin 'ModalDialog' which handles clicking the modal dialog
popups.  I'll copy in the code for it below.  When I try to run a script I
get the following error, which is on the line which does the 'include
ModalDialog'.

C:/Java/workspace/eplan/src
/watir/scripts/simple/product/../../../lib/login/logi
n.rb:8:in `include': wrong argument type Class (expected Module) (TypeError)
       from
C:/Java/workspace/eplan/src/watir/scripts/simple/product/../../../l
ib/login/login.rb:8
       from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`ge
m_original_require'
       from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`re
quire'
       from
C:/Java/workspace/eplan/src/watir/scripts/simple/product/tc_login_a
ll_products.rb:40

I have other problems as well.  For example, I get errors when I try to use
command line options.  I thought the support for that was built into Ruby so
I don't understand the errors.

I feel like there must be some basic thing I am missing about this new
version of Watir, or about installing it as a gem, or installing it in
Vista, or something.  I have added the environment variable
"RUBYOPT=rubygems".  I've searched both the Watir and Ruby mailing lists.
Can anyone help me?  If not, I'm going to have to throw in the towel on
Vista anyway, and maybe eventually on Watir.

Thanks
Lisa

Here's that mixin:
module ModalDialog

 # Convenience method to click the OK button
 def click_modal_ok_button(sleep_time=4, timeout=20)
   click_modal_button('OK', sleep_time, timeout)
 end

 # Convenience method to click the Cancel button
 def click_modal_cancel_button(sleep_time=4, timeout=20)
   click_modal_button('Cancel', sleep_time, timeout)
 end

 # Main method to click a modal dialog button.
 def click_modal_button(type='OK', sleep_time=4, timeout=20)
   Thread.new {
     sleep sleep_time
     w = WinClicker.new
     w.clickWindowsButton('Microsoft Internet Explorer', "#{type}",
timeout)
   }
 end

 def check_for_popups
       autoit = WIN32OLE.new('AutoItX3.Control')
       #
       # Do forever - assumes popups could occur anywhere/anytime in your
application.
       loop do
           # Look for window with given title. Give up after 1 second.
           ret = autoit.WinWait('Microsoft Internet Explorer', '', 1)
           #
           # If window found, send appropriate keystroke (e.g. {enter},
{Y}, {N}).
           if (ret==1) then
             puts("Found window, now trying to activate")
             autoit.WinActivate('Microsoft Internet Explorer','')
             active = autoit.WinActive('Microsoft Internet Explorer','')
             if (active == 1) then
               puts("Activated the Window I found")
               autoit.Send('{enter}')
               puts("Found a window to click")
             end
             # autoit.Send('{enter}')
             # puts("Found a window to click")
           end
           #
           # Take a rest to avoid chewing up cycles and give another thread
a go.
           # Then resume the loop.
           sleep(3)
       end
   end


end


<http://lisa.crispin.home.att.net>
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to