[Webtest] Another problem related to javascript
Lisa Crispin
webtest@lists.canoo.com
Mon, 04 Apr 2005 22:32:59 +0000
--NextPart_Webmail_9m3u9jl4l_7549_1112653979_0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
Our web app uses javascript to prevent users from clicking certain buttons twice. When we first started using WebTest, we had to create a flag to disable that javascript so that our WebTest scripts could run. Now that WebTest is based on HtmlUnit and should support a lot more Javascript, I hoped the scripts would work with the javascript enabled (it would allow us to run some smoke tests against our staging and production environments to verify releases). However, it doesn't. Here is the javascript, form and button, followed by the WebTest syntax and the error message. Would anyone have advice for us?
<script languange="javascript">
var formCount0 = 0;
function formOnSubmit0() {
formCount0++;
if (formCount0 > 1) { alert('This page has already been submitted!'); event.returnValue = false; }
else { event.returnValue = true; }
}
</script>
<form method="post" action="login.jsp?submit=1&ts=65021" onSubmit="javascript: formOnSubmit0();">
<input name="submitBtn" value="Submit" type="submit" class="formButton">
</form>
WebTest script:
<clickbutton stepid="Submit the plan features"
name="submitButton"/>
Error:
C:\java\eplan70\build.xml:1254: The following error occurred while executing this line:
Test step clickbutton (C:\java\eplan70\src\web_test\modules\planEstStep1.xml:97:)
named "Submit the plan features" failed with message "Step "clickbutton "Sub
mit the plan features" (35/122): Script error executing at: click button"
--NextPart_Webmail_9m3u9jl4l_7549_1112653979_0
Content-Type: text/html
Content-Transfer-Encoding: 8bit
<html>
<!-- BEGIN WEBMAIL STATIONERY -->
<head></head>
<body>
<!-- WEBMAIL STATIONERY noneset -->
<DIV></DIV>
<DIV>
<DIV>Our web app uses javascript to prevent users from clicking certain buttons twice. When we first started using WebTest, we had to create a flag to disable that javascript so that our WebTest scripts could run. Now that WebTest is based on HtmlUnit and should support a lot more Javascript, I hoped the scripts would work with the javascript enabled (it would allow us to run some smoke tests against our staging and production environments to verify releases). However, it doesn't. Here is the javascript, form and button, followed by the WebTest syntax and the error message. Would anyone have advice for us?</DIV>
<DIV> </DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><script languange="javascript"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">var formCount0 = 0;<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">function formOnSubmit0() {<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>formCount0++;<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>if (formCount0 > 1) { alert('This page has already been submitted!'); event.returnValue = false; }<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>else { event.returnValue = true; }<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">}<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"></script><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><form method="post" action="login.jsp?submit=1&ts=65021" onSubmit="javascript: formOnSubmit0();"><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><input name="submitBtn" value="Submit" type="submit" class="formButton"></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"></form></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">WebTest script:</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <clickbutton stepid="Submit the plan features"<BR> name="submitButton"/></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Error:</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">C:\java\eplan70\build.xml:1254: The following error occurred while executing this line:<BR>Test step clickbutton (C:\java\eplan70\src\web_test\modules\planEstStep1.xml:97:)</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> named "Submit the plan features" failed with message "Step "clickbutton "Sub<BR>mit the plan features" (35/122): Script error executing at: click button"</P></DIV></DIV>
<!-- END WEBMAIL STATIONERY -->
</body>
</html>
--NextPart_Webmail_9m3u9jl4l_7549_1112653979_0--