Hi,
I was following this thread to click on a JavaScript invoked Confirmation
Dialog.
JavaScript on Page, looks something like this.
****************************************************************************
************************************
<SCRIPT language=JAVASCRIPT>
function validate_form() {
dml=document.forms['SIDsForm'];
len=dml.elements.length;
var i=0;
for(i=0;i<len;i++)
{
if(dml.elements[i].checked){
return (confirm("Selected will be removed!"));
}
}
alert("Please Select to remove.");
return false;
<!--
if (document.Form.groupsid.checked ){
return true;
}
else {
alert("Please fill in the Name.");
return false;
}
-->
}
</SCRIPT>
****************************************************************************
************************************
I have got a point where the Confirmation dialog was prompted, but no
clicking action was performed.
startClicker("OK")
ie.button(:value,"buttonconfirmdelete").click
I understand that 1.4 has this 'watir/WindowHelper', how does it applies in
this case.
Thanks.
Regards,
Fred
============================================================================
============
When you say 'Popup Window' do you mean: 1) a JavaScript Alert, Confirm,
or Prompt? Or 2) do you mean another browser window that has form
information which gets posted back to the parent that has the 'Add"
button on it? The following have worked for me in both situations.
If it is #1 then this works for the JavaScript type popup:
#define the popup method first (this is right out of
unittests\popups_test.rb)
def startClicker( button , waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)
c = "start rubyw #{shortName }\\watir\\clickJSDialog.rb #{button }
#{ waitTime} "
puts "Starting #{c}"
w.winsystem(c)
w=nil
end
#then call it just before your button click
startClicker("OK" , 3)
$ie.button("Submit").click
If it is #2 then this works for the browser window 'Popup'
#parent window clicks the button
$ie.button( "Add Causal Codes" ).click
sleep 3
#child form window pops up and get posted pack to the parent
cw = IE.attach( :title, /PER Causal Code Management/i ) #this could
also be a URL
cw.selectBox( :index, 1).select(/A1/ )
cw.selectBox( :index, 3).select(/B1/ )
cw.selectBox( :index, 11).select(/C01/ )
cw.button( "Add Causal Codes" ).click
cw.button( "Close Window" ).click
Hope this helps.
--Mark
________________________________
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Ramya Ramalinga,
Moorthy (IE10)
Sent: Monday, April 25, 2005 10:15 PM
To: wtr-general at rubyforge.org
Subject: [Wtr-general] Accessing Pop up Dialog Controls
Hi All,
I would like to know how to access the standard controls available in
the Popup Window.
I tried to get the Handle of the Popup window & tried accessing the
controls(Eg:ComboBox) using Winclicker Class , but I am getting the
error message as " undefined method `getWindowTitle' for
WinClicker:Class (NoMethodError) " .
$ie = Watir::IE.start('...')
#On Click of this Add button, new popup window is opened
$ie.button(:caption, "Add").click
#Getting the Handle of the newly opened Popup window
hTheActiveWindow = Win32API.new("user32", "GetActiveWindow", [], 'I')
#Getting the Title of the Popup window
wincaption=WinClicker.getWindowTitle(hTheActiveWindow)
#Now using this Popup window handle, I can get all the child handles &
then call setComboBoxText(hwnd , settext)
Can anyone help me in this regard. Thanks for any of your suggesstions
Regards,
Ramya
Send instant messages to your online friends http://asia.messenger.yahoo.com
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general