[Webtest] Java Script Function is not recognized

Harold Flores webtest@lists.canoo.com
Mon, 15 May 2006 15:51:54 -0500


Hi All,

We are trying to implement a Canoo WebTest script for the login page of 
our application.
After invoking the click Login button step, we get a message about a non 
existing function saveUserName().
        <step>
               <parameter name="taskName" value="clickButton"/>
               <parameter name="label" value="Login"/>
               <parameter name="description" value="Click the submit 
button"/>
               <result>
                   <failed duration="922"/>
               </result>
           </step>
           <step>
               <parameter name="text" value="Warranty Claim System"/>
               <parameter name="taskName" value="verifyTitle"/>
               <parameter name="description" value="Home Page follows if 
login ok"/>
               <result>
                   <notexecuted duration="0"/>
               </result>
           </step>
           <failure 
message="com.canoo.webtest.engine.StepFailedException: Step[clickButton 
"Click the submit button" (5/6)]: Script error loading page executing 
webtest at: clickButton TypeError: saveUserName is not a function, it is 
null. (event for HtmlForm[<form onsubmit="saveUserName(this); return 
validateForm(this)"; 
action="/wcs/authorize;jsessionid=E201D7AA9EA7F2D8EEE15E76A3D0B4A7" 
method="post" id="loginForm">]#1)Source code:function () {[native code, 
arity=0]}, Step: ClickButton at 
C:\WCS\hendrickson-base-head\test\canoo\canoo-web-test.xml:45:  with 
(taskName="clickButton", label="Login", description="Click the submit 
button")"/>

The saveUserName() method is a java script function and it is present in 
the page as it follows:
<!--
<script type="text/javascript">
       function saveUsername(theForm) {
       var expires = new Date();
       expires.setTime(expires.getTime() + 24 * 30 * 60 * 60 * 1000); // 
sets it for approx 30 days.                        }
  </script>
//-->

Is there a way to indicate to Canoo WebTest to recognize the java script 
function even it is enclosed between  comment tags ("<!--"  and "//-->")?

Thanks for any answer.

Harold.