Re: How do I execute JavaScript Function if I am using HttpUnitOptions.setScriptingEnabled(false)
Wolfgang Fahl <[email protected]> Fri, 19 Nov 2010 17:00:13 +0100
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Organization | BITPlan GmbH |
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============1439206594204174586==
Content-Type: multipart/alternative;
boundary="------------020200090604020906010608"
This is a multi-part message in MIME format.
--------------020200090604020906010608
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
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
> [email protected]
> 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
--------------020200090604020906010608
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Amit,<br>
<br>
You wrote:<br>
>please can anyone suggest how can I execute this JavaScript
Function having HttpUnitOptions.setScriptingEnabled set to false.<br>
You can't. Period.<br>
<br>
Please read the FAQ javascript section for further info.<br>
<br>
Cheers<br>
Wolfgang<br>
<br>
<br>
Am 19.11.10 16:57, schrieb Amit Oberoi:
<blockquote cite="mid:[email protected]"
type="cite">
<style type="text/css"><!-- DIV {margin:0px;} --></style>
<div style="font-family: times new roman,new york,times,serif;
font-size: 12pt;">
<div>Hi,</div>
<div>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).</div>
<div>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.</div>
<div>My code snippet lokks like below:</div>
<div>Button[] buttons = form.getButtons();<br>
for(int i=0; i < buttons.length; i++) {<br>
if(buttons[i].getAttribute("value").equalsIgnoreCase("search"))
{<br>
boolean check =
engine.createHandler(buttons[i]).doEventScript("onClick");<br>
System.out.println(check);<br>
response = b2bTracker.getCurrentPage();<br>
System.out.println(response.getTitle());<br>
<br>
}</div>
<div>Submit Form finction looks like below</div>
<div>function submitForm()<br>
{<br>
var Submitt = "true";<br>
var tBoxValue = document.getElementById("tbox").value;<br>
var tAreaValue = document.getElementById("tarea").value;<br>
<br>
if(document.getElementById("tbox").style.visibility ==
"visible")<br>
{<br>
if( !(tBoxValue == "") )<br>
{<br>
document.getElementById("searchContent").value =
document.getElementById("tbox").value;<br>
}<br>
else<br>
{<br>
alert("Enter the Search Content in the TextBox");<br>
Submitt = "false";<br>
document.getElementById("tbox").focus();<br>
}<br>
}<br>
else if( document.getElementById("tarea").style.visibility ==
"visible")<br>
{<br>
if ( !(tAreaValue == "") )<br>
{<br>
document.getElementById("searchContent").value =
document.getElementById("tarea").value;<br>
}<br>
else<br>
{<br>
alert("Enter the Search Content in the TextArea");<br>
Submitt = "false";<br>
document.getElementById("tarea").focus();<br>
}<br>
}<br>
<br>
auditLog = document.getElementById("audit").checked;<br>
errorLog = document.getElementById("error").checked;<br>
debugLog = document.getElementById("debug").checked;<br>
<br>
if(auditLog == false && errorLog == false &&
debugLog == false)<br>
{<br>
alert("Please Select atleast One type of LOG");<br>
Submitt = "false";<br>
}<br>
else<br>
{<br>
document.getElementById("searchInAuditLog").value =
auditLog;<br>
document.getElementById("searchInErrorLog").value =
errorLog;<br>
document.getElementById("searchInDebugLog").value =
debugLog;<br>
}<br>
<br>
startDate = document.getElementById("txtStartDate").value;<br>
endDate = document.getElementById("txtEndDate").value;<br>
<br>
if(GetDate(startDate) > GetDate(endDate))<br>
{<br>
alert("StartDate shoudn't be greater than the EndDate");<br>
Submitt = "false";<br>
}<br>
<br>
document.getElementById("searchInZipFile").value
= document.getElementById("srchInZipFile").checked;<br>
<br>
<br>
if(Submitt == "true")<br>
{<br>
document.searchForm.action = "mtracker.do";<br>
document.searchForm.submit();<br>
}<br>
<br>
}</div>
<div> </div>
<div>Thanks in antocipation of a positive response.</div>
<div> </div>
<div>Regards</div>
<div> </div>
<div>Amit</div>
</div>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
------------------------------------------------------------------------------
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
<a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/msIE9-sfdev2dev">http://p.sf.net/sfu/msIE9-sfdev2dev</a></pre>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Httpunit-develop mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/httpunit-develop">https://lists.sourceforge.net/lists/listinfo/httpunit-develop</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
BITPlan - smart solutions
Wolfgang Fahl
Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
Tel. +49 2154 811-480, Fax +49 2154 811-481
Web: <a class="moz-txt-link-freetext" href="http://www.bitplan.de">http://www.bitplan.de</a>
BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl </pre>
</body>
</html>
--------------020200090604020906010608--
--===============1439206594204174586==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
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
--===============1439206594204174586==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop
--===============1439206594204174586==--