[Wtr-general] Give a solution fo javascript popup
Cain, Mark
Mark_Cain at RL.gov
Tue Jan 2 17:50:57 EST 2007
Do I have access to edit the FAQ page? I have a login.
--Mark
________________________________
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Charley Baker
Sent: Tuesday, January 02, 2007 2:38 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] Give a solution fo javascript popup
Mark,
You mind posting that to the FAQ site? Definitely an FAQ and then you
or anyone can send out the url.
-Charley
On 1/2/07, Cain, Mark <Mark_Cain at rl.gov> wrote:
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:\t est.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: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Charley Baker
Sent: Thursday, December 21, 2006 8:22 AM
To: wtr-general at rubyforge.org
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 <forum-watir-users at openqa.org> 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
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070102/93a0c514/attachment.html
More information about the Wtr-general
mailing list