You need to have defined the startClicker() method somewhere in your script.  It is mostly reliable.

 

Do something like this:

 

require 'watir/WindowHelper'
require 'watir'
require 'toolkit/onc_login'
require 'toolkit/onc_logout'
require 'toolkit/_javascript_Hd'

 

# Add this method to your script

def startClicker( button , waitTime = 3)
   w = WinClicker.new
   longName = $ie.dir.gsub("/" , "\\" )
   shortName = w.getShortFileName(longName)
   c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button} #{waitTime} "
   puts "Starting #{c}"
   w.winsystem(c)
   w=nil
end

 

login

$ie.link(:text, "Search for Protocol").click

$ie.textField(:id, "str").set("J0260")

$ie.button(:name, "search").click

listTable = $ie.table(:id, "enroll_list")

# here, there are some hidden field, maybe that's why the number of rows is 22
$ie.checkbox(:index, 5).set
$ie.button(:value, "Consent").click

 

startClicker("OK", 3)
$ie.button("Submit").click

 

Hope this helps,

 

--Mark

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of gege qian
Sent: Thursday, April 13, 2006 7:27 AM
To: [email protected]
Subject: [Wtr-general] Asking two questions related on _javascript_ pop upwindow

 

Hi Paul  

 

I'm new to watir and ruby. I have two questions to ask

1) i read the post on http://rubyforge.org/pipermail/wtr-general/2005-April/001427.html. I tried the way paul suggested, but never succeed.

 

here is the code

 

require 'watir/WindowHelper'
require 'watir'
require 'toolkit/onc_login'
require 'toolkit/onc_logout'
require 'toolkit/_javascript_Hd'

login

$ie.link(:text, "Search for Protocol").click

$ie.textField(:id, "str").set("J0260")

$ie.button(:name, "search").click

listTable = $ie.table(:id, "enroll_list")

# here, there are some hidden field, maybe that's why the number of rows is 22
$ie.checkbox(:index, 5).set
$ie.button(:value, "Consent").click

startClicker("OK", 3)
$ie.button("Submit").click


helper = WindowHelper.new
helper.push_confirm_button_ok()

The button on the pop up window was never clicked

would you mind giving me some feedback on this

 

2)
In our application , we have a calendar image, which user can click on for selecting
the date. I do not know if there is a way to a)pop up the calendar, b)and select the date.
the html source code is as follows:
<table class="header_info"><tr valign="top"><td ><label>  *Date consented</label><br />
<input class="date" id="consents_530" name="consents[530][date_consent_signed]" size=12 type="text" />
<br />
</td>
<td ><br />
<img alt=Calendar class=date id=consents_530_b src="" title="Show calendar"/>
<script type="text/_javascript_">
Calendar.setup({ inputField:"consents_530", button:"consents_530_b", cache:true, ifFormat:"%m/%d/%Y", firstDay:0, range:[1956,2008], showOthers:true, step:1 })
</script>
</td>
</tr>
</table>

 

Thanks a lot

gege


Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.

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

Reply via email to