HI all,
I am new to Watir and am still in the process of learning (with the
examples in the site: http://wiki.seleniumhq.org/display/WTR/Tutorial).
I am trying to handle a popup (when deleting email without actually
selecting any email for deletion) from the Yahoomail web page. The
popup does not even show up and the script times out. But when I
manually click the Delete button, the Pop up does show up. This is the
code I used:
----------------------------
require 'watir'
require 'watir/ie'
require 'test/unit'
require 'watir/contrib/enabled_popup'

class TC_Popups < Test::Unit::TestCase

 ie = Watir::IE.new
 ie.goto("http://www.mail.yahoo.com";)

#login into Yahoo mail
ie.text_field(:name, "login").set("loginID")
ie.text_field(:name, "passwd").set("loginpswd")
ie.button(:name, ".save").click

#Goto into the Inbox
puts "select the Inbox link"
ie.span(:id, "_test_Inbox").click

# Select delete button without selecting any email to delete
puts "Select the Delete button"
ie.table(:text, "Delete").click_no_wait

#To handle the popup - code Burrowed from 
http://wiki.seleniumhq.org/display/WTR/JavaScript+Pop+Ups
Timeout::timeout(15)do
        begin
            if ie.enabled_popup
                hwnd = ie.enabled_popup(15)
                w = WinClicker.new
                w.makeWindowActive(hwnd)
                w.clickWindowsButton_hWnd(hwnd,"OK")
            end
                rescue Timeout::Error
            puts 'No popup existed'
        end
    end
end
--------------------------------------------
I can see the Delete button being selected, but there is no pop up.
This is the error I am getting in my cmd prompt:
---------------------------------------------
c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/watir/waiter.rb:
59:in `wait
_until': Timed out after 4.14 seconds.
(Watir::Exception::TimeOutException)
        from c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/
watir/waiter.r
b:80:in `wait_until'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
contrib/enable
d_popup.rb:10:in `enabled_popup'
        from C:/Documents and Settings/NK/Desktop/Watir Scripts/
popup.rb:33
        from c:/ruby/lib/ruby/1.8/timeout.rb:56:in `timeout'
        from C:/Documents and Settings/NK/Desktop/Watir Scripts/
popup.rb:31
-----------------------------------------------

Can someone point out what I am doing wrong?
Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
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