I have posted this many time, it is the most reliable JS popup method I
have every used. It will even work for the input box (by supplying the
user_input="whatever the user would input") and file upload dialog (by
supplying user_input='&Save' or '&Open'). It is better and more
reliable than the one linked below.
require 'watir\contrib\enabled_popup'
def startClicker( button , waitTime=9, user_input=nil )
hwnd = $ie.enabled_popup(waitTime) # get a handle if one exists
if (hwnd) # yes there is a popup
w = WinClicker.new
if ( user_input )
w.setTextValueForFileNameField( hwnd, "#{user_input}" )
end
sleep 3 # I put this in to see the text being input it is not
necessary to work
w.clickWindowsButton_hwnd( hwnd, "#{button}" ) # "OK" or
whatever the name on the button is
w=nil # this is just cleanup
end
end
$ie=Watir::IE.start("c:\test.htm")
# This is whatever object that uses the click method.
# You MUST use the click_no_wait method.
$ie.image(:id,'3').click_no_wait
startClicker("OK", 7, "User Input") # 3rd parameter is optional.
--Mark
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Charley Baker
Sent: Thursday, December 21, 2006 8:22 AM
To: [email protected]
Subject: Re: [Wtr-general] Give a solution fo javascript popup
Google is your friend, searching for watir javascript dialog, this is
the first link:
http://www.hanselman.com/blog/ClickingAJavaScriptDialogUsingWatir.aspx
-Charley
On 12/20/06, liucongying <[EMAIL PROTECTED]> wrote:
I use ruby185-21 and watir-1.5.1.1127.gem, I want a solution fo js pop
the web html is the one in watir \unittests\html
---JavascriptClick.html。
So i hope someone can give me codes of watir to solve js popup,do not
use aotoit! thanks
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5883&messageID=16456#16456
_______________________________________________
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