[Webtest] Problems with input of type=button

Fco. Javier Moran Rua webtest@lists.canoo.com
Mon, 26 Apr 2004 17:44:57 +0200


Hi,

I use webtest build 432, the latest available in the web, for testing a
very simple web page with an input of type=3Dbutton. However, the test
fails with the following error message:

com.canoo.webtest.engine.StepFailedException: Button with name <OK> and
value <OK> not found!, Step: ClickButton(id=3D"Hacer click"label=3DOK)

The simple HTML code used for this proof is:

<script language=3D"JavaScript">
    function do_submit()
    {
        f.submit();
    }
</script>
                                                                           =
 =20
<div>
    <form name=3D"f" action=3D"/" method=3D"POST">
        <input type=3D"button" onclick=3D"javascript:do_submit()"=20
         name=3D"OK" value=3D"OK"/>
  </form>
</div>

I tried to make the form submit without using a javascript function,
that's to say, I used the line:

        <input type=3D"button" onclick=3D"this.f.submit()"=20
         name=3D"OK" value=3D"OK"/>

and the error was the same. Another important information is that if I
replace the type of the input by a type=3D"submit", the test is
successful.

The xml code used for the test is:

<testSpec name=3D"instaladores - Prueba button">
 &instaladores_include;
 <steps>
   &instaladores_button;
 </steps>
</testSpec>

instaladores_include.xml:

 <config
   protocol=3D"http"
   host=3D"${instaladores.hostname}"
   port=3D"${port}"
   basepath=3D"${basepath}"
   haltonerror=3D"false"
   haltonfailure=3D"false"
   verbose=3D"true"
   resultfile=3D"${webtest.result}"
   showhtmlparseroutput=3D"false"
   saveresponse=3D"true"
   summary=3D"true" />

instaladores_button.xml :

<clickbutton stepid=3D"Hacer click" name=3D"OK" label=3D"OK">
  <form name=3D"f" /> =20
</clickbutton>

Besides, I have tried to set the configuration paremeter
showhtmlparseroutput=3D"true" and I have not seen any error, only no
relevant warnings.

I have read the archives of the canoo webtest list and someone said that
there was a patch which solved this problem and was integrated in the
main build. I read in another message that someone has got to submit
and validate forms with inputs of type=3Dbutton with Javascript.  For this
reason, I am confused. It is very important for me to have this feature
running in webtest because I have a lot of forms which are submitted in
this way.

Could anyone help me ?

Cheers !!

--=20
Francisco Javier Mor=E1n R=FAa
Ingeniero en Inform=E1tica
Telf +34 981 91 39 91 - Ext 13
mailto:jmoran@igalia.com
IGALIA S.L. http://www.igalia.com