[Webtest] Login Problem

Ian Phillips Ian Phillips" <phillipsic@gmail.com
Fri, 27 Apr 2007 17:57:01 +0200


------=_Part_148044_7092000.1177689421694
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi.

I am having a problem getting webtest to login.  It appears not to accept
the username and/or password.

My login page looks like this:

FORM METHOD=post ACTION
="index.php">
<table align=center>
	<
tr><th>Name: <td><INPUT SIZE=10
NAME="login">
	<tr><th>Password:<
td> <INPUT SIZE=10 TYPE="password"
NAME="passwd">
	<tr><td colspan
=2 align=center>

	<INPUT
 TYPE="hidden" NAME="what" VALUE=
"loggon_step">
	<INPUT TYPE="hidden" NAME=
"myGroup" VALUE="-1">
	<INPUT TYPE=
"submit" VALUE=" Login ">
</table>
</FORM>

My script looks like this:

<project name="SimpleTest" basedir="." default="main">

  <property name="webtest.home" location="C:\canoo" />
  <import file="${webtest.home}/lib/taskdef.xml"/>

  <target name="main">
    <webtest name="myTest">
      <config
        host="wokingham"
        port="29920"
        protocol="http"
        basepath=""
        summary="true"
        saveresponse="true"
        autorefresh="true"/>

      <steps>
        <invoke
          description="get Login Page"
          url="" />
        <verifyTitle
          description="we should see the login title"
          text="KPSA" />
        <setInputField description="set user name"
          name="login"
          value="KOPAdmin" />
        <setInputField description="set password"
          name="passwd"
          value="*****" />
        <clickButton
          label=" Login "
          description="Login" />
        <verifyTitle
          description="we should see the Admin title"
          text="KPSA Administration" />
      </steps>
    </webtest>
  </target>
</project>

I can manually login so I know the username/password are OK.  When I run the
test above I get a page saying the login has failed.  None of the steps
appear to fail until I try to validate the title of the admin page.

Thanks for any help.

Ian

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

Hi.<br><br>I am having a problem getting webtest to login.&nbsp; It appears not to accept the username and/or password.<br><br>My login page looks like this:<br><br><pre><span>FORM</span><span> METHOD</span>=<span>post </span><span>
ACTION<br></span>=<span>&quot;index.php&quot;</span>&gt;<br>&lt;<span>table</span><span> align</span>=<span>center</span>&gt;<br>	&lt;<span><br>tr</span>&gt;&lt;<span>th</span>&gt;Name: &lt;<span>td</span>&gt;&lt;<span>INPUT
</span><span> SIZE</span>=<span>10 </span><br><span>NAME</span>=<span>&quot;login&quot;</span>&gt;<br>	&lt;<span>tr</span>&gt;&lt;<span>th</span>&gt;Password:&lt;<span><br>td</span>&gt; &lt;<span>INPUT</span><span> SIZE</span>
=<span>10 </span><span>TYPE</span>=<span>&quot;password&quot; <br></span><span>NAME</span>=<span>&quot;passwd&quot;</span>&gt;<br>	&lt;<span>tr</span>&gt;&lt;<span>td</span><span> colspan<br></span>=<span>2 </span><span>align
</span>=<span>center</span>&gt;<br></pre><pre>	&lt;<span>INPUT</span><span><br> TYPE</span>=<span>&quot;hidden&quot; </span><span>NAME</span>=<span>&quot;what&quot; </span><span>VALUE</span>=<span><br>&quot;loggon_step&quot;
</span>&gt;<br>	&lt;<span>INPUT</span><span> TYPE</span>=<span>&quot;hidden&quot; </span><span>NAME</span>=<span><br>&quot;myGroup&quot; </span><span>VALUE</span>=<span>&quot;-1&quot;</span>&gt;<br>	&lt;<span>INPUT</span>
<span> TYPE</span>=<span><br>&quot;submit&quot; </span><span>VALUE</span>=<span>&quot; Login &quot;</span>&gt;<br>&lt;/<span>table</span>&gt;<br>&lt;/<span>FORM</span>&gt;<br></pre>My script looks like this:<br><br>&lt;project name=&quot;SimpleTest&quot; basedir=&quot;.&quot; default=&quot;main&quot;&gt;
<br><br>&nbsp; &lt;property name=&quot;webtest.home&quot; location=&quot;C:\canoo&quot; /&gt;<br>&nbsp; &lt;import file=&quot;${webtest.home}/lib/taskdef.xml&quot;/&gt;<br><br>&nbsp; &lt;target name=&quot;main&quot;&gt;<br>&nbsp;&nbsp;&nbsp; &lt;webtest name=&quot;myTest&quot;&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;config<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; host=&quot;wokingham&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; port=&quot;29920&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protocol=&quot;http&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; basepath=&quot;&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; summary=&quot;true&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; saveresponse=&quot;true&quot;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; autorefresh=&quot;true&quot;/&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;steps&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;invoke<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; description=&quot;get Login Page&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url=&quot;&quot; /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;verifyTitle<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; description=&quot;we should see the login title&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text=&quot;KPSA&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;setInputField description=&quot;set user name&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; name=&quot;login&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; value=&quot;KOPAdmin&quot; /&gt;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;setInputField description=&quot;set password&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; name=&quot;passwd&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; value=&quot;*****&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;clickButton<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; label=&quot; Login &quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; description=&quot;Login&quot; /&gt;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;verifyTitle<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; description=&quot;we should see the Admin title&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text=&quot;KPSA Administration&quot; /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/steps&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/webtest&gt;<br>&nbsp; &lt;/target&gt;<br>
&lt;/project&gt;<br><br>I can manually login so I know the username/password are OK.&nbsp; When I run the test above I get a page saying the login has failed.&nbsp; None of the steps appear to fail until I try to validate the title of the admin page.&nbsp; 
<br><br>Thanks for any help.<br><br>Ian<br><br><br>

------=_Part_148044_7092000.1177689421694--