Hello Charley,

I am having a difficult time with handling popup window too.  I followed your 
suggestion and used the second example.  I just want to click cancel button on 
the file download window to close it.  The script run complete with Exit code: 
0 (please see the code below), but the file download window is still open.  Any 
suggestions, please.

I really appreciate your help.
Kui

# A Better Popup Handler using the latest Watir version. Posted by [EMAIL 
PROTECTED]
    #
    require 'watir'
    require 'watir\contrib\enabled_popup' 
    #
    def startClicker( button , waitTime= 9, user_input=nil )
      # get a handle if one exists
      hwnd = $ie.enabled_popup(waitTime)  
      if (hwnd)  # yes there is a popup
        w = WinClicker.new
        if ( user_input ) 
          w.setTextValueForFileNameField( hwnd, "#{user_input}" )
        end
        # I put this in to see the text being input it is not necessary to work
        sleep 3         
        # "OK" or whatever the name on the button is
        w.clickWindowsButton_hwnd( hwnd, "#{button}" )
        #
        # this is just cleanup
        w=nil    
      end
    end
    #
    # MAIN APPLICATION CODE
    #
    $ie = Watir::IE.start( "http://localhost:8080/cc/ClaimCenter.do"; )

    # This is whatever object that uses the click method.  
    # You MUST use the click_no_wait method.
    $ie.frame(:name, "top_frame").button(:id, 
"ClaimNewDocumentLinkedWorksheet:NewDocumentLinkedScreen:DocumentAttachmentDV:Attachment").click_no_wait
    #
    # 3rd parameter is optional and is used for input and file dialog boxes.
    startClicker( "Calcel", 7 , "" )
    #
    # Main application code follows
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to