[Webtest] "Cannot call method "submit" of undefined" Error when test a login page

lostinheaven.lee@gmail.com lostinheaven.lee@gmail.com
Tue, 2 Sep 2008 18:52:31 +0800


------=_Part_2194_4627510.1220352751388
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi, Everyone

I wrote an easy testcase for a login page. Just invoke the url ,then find
the button by xpath and click it.The form will submint login datas and goto
another page.
the ID and pass word is write in the html, so no need to set input.
I'm srue the xpath is right , it gets wrong at the last step.I don't know is
it Script problem or the JS in the page have any bug. and  I don't think
it's the method "submit" is the real point.

 It will be greatly appreciate if anyone could tell me the reason or your
opinion.
Please DO reply me if you had met the same problem.

thanks

* The error message:*

JavaScript error loading page http://192.xxx.xx.xx:8080/Ash/: TypeError:
Cannot call method "submit" of undefined (script in
http://192.xxxxx.xx:8080/Ash/ from (16, 31) to (0, 0)#37)
*My Script:*

<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "../dtd/Project.dtd">
<project default="ifdmsLogintest">

    <target name="ifdmsLogintest">

        <webtest name="check the login founction">
            <invoke url="http://192.xxx.xx.xx:8080/Ash/" description="Go to
asahi login"/>
            <clickButton xpath="//input[@type = 'button']"
description="login" />

        </webtest>
    </target>
</project>

------=_Part_2194_4627510.1220352751388
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div>Hi, Everyone</div>
<div>&nbsp;</div>
<div>I wrote an easy testcase for a login page. Just invoke the url ,then find the button by xpath and click it.The form will submint login datas and goto another page.</div>
<div>the ID and pass word&nbsp;is write in the&nbsp;html, so no need to set input. </div>
<div>I&#39;m srue the xpath is right , it gets wrong at the last step.I don&#39;t know is it Script problem or the JS in the page have any bug. and &nbsp;I don&#39;t think it&#39;s the method &quot;submit&quot; is the real point. </div>

<div>&nbsp;</div>
<div>
<div>It will be greatly appreciate if&nbsp;anyone could tell me the reason or your opinion.</div>
<div>Please DO reply me if you had met the same problem.</div>
<div>&nbsp;</div>
<div>thanks</div>
<div>&nbsp;</div></div>
<div><strong>&nbsp;The error message:</strong></div>
<div>
<p>JavaScript error loading page <a href="http://192.xxx.xx.xx:8080/Ash/">http://192.xxx.xx.xx:8080/Ash/</a>: TypeError: Cannot call method &quot;submit&quot; of undefined (script in <a href="http://192.xxxxx.xx:8080/Ash/">http://192.xxxxx.xx:8080/Ash/</a> from (16, 31) to (0, 0)#37)</p>
</div>
<div><strong>My Script:</strong></div>
<div>&nbsp;</div>
<div>&lt;?xml version=&quot;1.0&quot;?&gt;</div>
<div>&lt;!DOCTYPE project SYSTEM &quot;../dtd/Project.dtd&quot;&gt;<br>&lt;project default=&quot;ifdmsLogintest&quot;&gt;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &lt;target name=&quot;ifdmsLogintest&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;webtest name=&quot;check the login founction&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;invoke url=&quot;<a href="http://192.xxx.xx.xx:8080/Ash/">http://192.xxx.xx.xx:8080/Ash/</a>&quot; description=&quot;Go to asahi login&quot;/&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;clickButton xpath=&quot;//input[@type = &#39;button&#39;]&quot; description=&quot;login&quot; /&gt;</div>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/webtest&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/target&gt;<br>&lt;/project&gt;<br></p>
<div>&nbsp;</div>

------=_Part_2194_4627510.1220352751388--