Hi, You can not execute javascript directly you can execute like this:
require 'watir' ie=Watir::IE.attach(:url,'https://mseventsppe.microsoft.com/ EventStudio/SectionManager.aspx?SectionType=Location') win=ie.document.parentWindow win.eval("window.showModalDialog(DialogURL) ") On May 5, 3:49 pm, pallavi shashidhar <[email protected]> wrote: > Hi there, > I have a part of the HTML code which looks like this : > > <tr> > <td class=labelcell align="right" ><div align="right" >Expenditure > Type<span class="leadon">*</span></div></td> > <td class=smallfieldcell > > <select name="expenditure_Type" onchange="getWPCodeNameList(this);" > class="combowidth1"><option value="0">----Choose----</option> > <option value="Purchase">Purchase</option> > <option value="Works">Works</option></select></td> > <td class=labelcell align="right" ><div align="right" >Bill Type<span > class="leadon">*</span></div></td> > <td class=smallfieldcell > > <select name="bill_Type" class="combowidth1"><option > value="0">----Choose----</option> > <option value="Running Bill">Running Bill</option> > <option value="Final Bill">Final Bill</option></select></td> > </tr> > <tr> > <td class=labelcell align="right"><div align="right" >WO/PO > Number</div></td> > <td class=smallfieldcell colspan=3> > <input type="text" name="codeList" value="" style="Display: none"><input > type="text" name="codeName" value="" style="WIDTH: 250px " > class="fieldinput"> > <span id="genricimage"><img src="../images/plus1.gif" onclick=" > callGenericScreenSchedule(this);" ></span> > <input type="text" name="worksName" value="" readonly="readonly" > style="WIDTH: 250px " class="fieldinput"></td> > </tr> > <tr> > <td class=labelcell align="right"><div align="right" > > >Contractor/Supplier</div></td> > > The function call is > function callGenericScreenSchedule(obj) > { > var categoryname1="WPNpurchase"; > var categoryname2="WPNworks"; > //var row=getRow(obj); > var opt=document.getElementById("expenditure_Type").value; > //alert(opt); > if(opt.toUpperCase()=="0" ) > { > alert("Select ExpenditureType "); > return;} > > if(opt.toUpperCase()=="CONTINGENCY" ) > { > alert(" This Option not available for Contingent Types "); > return; > > } > > if(opt.toUpperCase()=="PURCHASE") > { > > window.showModalDialog("../commonyui/egov/genericScreenNoParent.jsp"+"?xmlconfigname="+"egf_config.xml"+"&categoryname="+"WPNpurchase",window,'dialogHeight:500px;dialogWidth:600px'); > > } > > else if(opt.toUpperCase()=="WORKS") > { > > window.showModalDialog("../commonyui/egov/genericScreenNoParent.jsp"+"?xmlconfigname="+"egf_config.xml"+"&categoryname="+"WPNworks",window,'dialogHeight:500px;dialogWidth:600px'); > > } > > if(nameValue!="") > { > document.forms[0].worksName.value=nameValue; > document.forms[0].codeList.value=idValue; > document.forms[0].codeName.value=descValue; > nameValue="";idValue="";descValue=""; > var wno=document.forms[0].codeList.value; > var mode="create"; > document.forms[0].action = > "../billsaccounting/worksBill.do?submitType=getTdsAndotherdtls&mode="+mode; > document.forms[0].submit(); > } > > } > > On selecting expenditure_Type, I then click on the search image (img > src="../images/plus1.gif" ) Which opens a modal dialog (title -"Search page > --Webpage Dialog") > That has numerous serch results with links. > I should be able to click a link and then click the Close button. > > Any ideas about how to hadle modal dialogs? > i have tried ; > b=Watir::Browser.start(MainURL) > b.select_list(:class,"combowidth1").select "Purchase" > b.image(:src,/plus1.gif/).click > md = window.showModalDialog(DialogURL) > > I get an error: undefined local variable or method `window' for main:Object > (NameError) > > Regards, > Pallavi --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to [email protected] Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---
