This is a shot in the dark but did you try explicitly setting the
WinClicker object w to nil after the popup is dismissed?
...
if (hwnd)
   w = WinClicker.new
   w.makeWindowActive(hwnd)
   w.clickWindowsButton_hwnd(hwnd, "OK")
   w = nil
end
...

OR You could create the WinClicker object when the test is initialized
and reuse that object throughout.

--Mark

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of George Hawthorne
Sent: Friday, October 27, 2006 6:07 AM
To: [email protected]
Subject: Re: [Wtr-general] WinClicker - too many callbacks are defined

Resending with missing error message added...

Hi,

The application I'm testing uses lots of modal Javascript alerts with
'OK' and 'Cancel' buttons. I'm using WinClicker to handle them and it
works very nicely until you get to the 11th pop-up, at which point it
throws the error: "DL::DLError: too many callbacks are defined." Watir
version is 1.5.1.1119 and IE version is 7. Details are below. I'd be
grateful for any thoughts.

Here's a test that consistently produces the error. It always works
perfectly for the first 10 instances and then fails on the 11th
instance...

     def test001
         1.upto 20 do |i|
           puts i.to_s
           # add an object
           $ie.button(:id, "addrow").click
          # delete the object
           $ie.button(:id, "deleterow").click_no_wait # this throws up
a Javascript alert
           # click OK on the pop-up
           hwnd = $ie.enabled_popup(5)           # get a handle if one
exists
            if (hwnd)
             w = WinClicker.new
             w.makeWindowActive(hwnd)
             w.clickWindowsButton_hwnd(hwnd, "OK")
             end
           $ie.wait
         end
     end

Here's the output...

Started
1
2
3
4
5
6
7
8
9
10
11
E
Finished in 38.226 seconds.

  1) Error:
test001(PMtest):
DL::DLError: too many callbacks are defined.
 
C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1119/./watir/winClicker.rb:30
8:in
`callback'
 
C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1119/./watir/winClicker.rb:30
8:in
`getChildHandle'
 
C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1119/./watir/winClicker.rb:25
4:in
`clickWindowsButton_hwnd'
    C:/eclipse/workspace/PM_tests/trial3.rb:113:in `test001'
    C:/eclipse/workspace/PM_tests/trial3.rb:100:in `upto'
    C:/eclipse/workspace/PM_tests/trial3.rb:100:in `test001'

Thanks, George
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to