Re: [Httpunit-develop] How do I execute JavaScript Function if I am using HttpUnitOptions.setScript
Brought to you by:
russgold
From: Wolfgang F. <wf...@bi...> - 2010-11-19 16:17:42
|
Hi Amit, You wrote: >please can anyone suggest how can I execute this JavaScript Function having HttpUnitOptions.setScriptingEnabled set to false. You can't. Period. Please read the FAQ javascript section for further info. Cheers Wolfgang Am 19.11.10 16:57, schrieb Amit Oberoi: > Hi, > I am testing a web application which is more of a message tracker. The > page I am stuck at present is a search page full of Java Script. To > avoid JavaScript exceptions I have used > HttpUnitOptions.setScriptingEnabled(false). > My problem is the search button on which there is onClick event which > submits the form via a JavaScript Fucntion submitForm(); there is no > submit button for the search form except this search button. Because I > have disabled the scripting even if I call > button.doEventScript("onClick") the web page is not moving ahead. > please can anyone suggest how can I execute this JavaScript Function > having HttpUnitOptions.setScriptingEnabled set to false. > My code snippet lokks like below: > Button[] buttons = form.getButtons(); > for(int i=0; i < buttons.length; i++) { > if(buttons[i].getAttribute("value").equalsIgnoreCase("search")) { > boolean check = > engine.createHandler(buttons[i]).doEventScript("onClick"); > System.out.println(check); > response = b2bTracker.getCurrentPage(); > System.out.println(response.getTitle()); > > } > Submit Form finction looks like below > function submitForm() > { > var Submitt = "true"; > var tBoxValue = document.getElementById("tbox").value; > var tAreaValue = document.getElementById("tarea").value; > > if(document.getElementById("tbox").style.visibility == "visible") > { > if( !(tBoxValue == "") ) > { > document.getElementById("searchContent").value = > document.getElementById("tbox").value; > } > else > { > alert("Enter the Search Content in the TextBox"); > Submitt = "false"; > document.getElementById("tbox").focus(); > } > } > else if( document.getElementById("tarea").style.visibility == "visible") > { > if ( !(tAreaValue == "") ) > { > document.getElementById("searchContent").value = > document.getElementById("tarea").value; > } > else > { > alert("Enter the Search Content in the TextArea"); > Submitt = "false"; > document.getElementById("tarea").focus(); > } > } > > auditLog = document.getElementById("audit").checked; > errorLog = document.getElementById("error").checked; > debugLog = document.getElementById("debug").checked; > > if(auditLog == false && errorLog == false && debugLog == false) > { > alert("Please Select atleast One type of LOG"); > Submitt = "false"; > } > else > { > document.getElementById("searchInAuditLog").value = auditLog; > document.getElementById("searchInErrorLog").value = errorLog; > document.getElementById("searchInDebugLog").value = debugLog; > } > > startDate = document.getElementById("txtStartDate").value; > endDate = document.getElementById("txtEndDate").value; > > if(GetDate(startDate) > GetDate(endDate)) > { > alert("StartDate shoudn't be greater than the EndDate"); > Submitt = "false"; > } > > document.getElementById("searchInZipFile").value > = document.getElementById("srchInZipFile").checked; > > > if(Submitt == "true") > { > document.searchForm.action = "mtracker.do"; > document.searchForm.submit(); > } > > } > Thanks in antocipation of a positive response. > Regards > Amit > > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today > http://p.sf.net/sfu/msIE9-sfdev2dev > > > _______________________________________________ > Httpunit-develop mailing list > Htt...@li... > https://lists.sourceforge.net/lists/listinfo/httpunit-develop -- BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl |