[Webtest] Re: functional tests with canoo: javascript

Stefan Ruff webtest@lists.canoo.com
Fri, 19 Sep 2003 13:12:57 +0200


Hi Michael 

we also had the problem to submit forms without a button. We use a 
proprietary framework.
HTML snippet:
<a href="javascript:performsubmit(buttonId, param1, paramValue1, ....)"> 

We can not use javascript (js.jar). 

Therefor we made a costum step to submit the form, and set the buttonId and 
the parameters. 

perhaps you can use our step 'performaction'. 

I posted source code and documentation of our custum step performaction a 
few days ago. 

Stefan 


Michael Parker writes: 

> Hi all,
> I refer to an posting of Dierk of my German question about "Funktionale
> Tests mit canoo ..."
> I reported a problem with "dynamic" submits without a button.
> They are generated by a third party taglib an are realized opposite to my
> first opinion in javascript.
> Dierk asked me for a html snippet:
> [..]
> <body>
> <form name="ProductForm" method="POST" action="do...."
> onsubmit="beforeSubmit()">
> [...hiddenfields ... ]
> <table>
> <tr>
> <td>A_in;
> <input type="text" name="A_in" value="-1" onchange="
> document.ProductForm....value='/dynsub/dynsub.jsp'; beforeSubmit();
> document.ProductForm.....value='A_in';ProductForm.submit();" onfocus="
> document.ProductForm.....value='@A_in';">
> </TD>
> <td>A_out
> <select name="A_opt" tabindex="4" onfocus="
> document.ProductForm.jvpms_nextfocus.value='@A_opt';">
> <option value="-1"></option>
> <option value="1">Zeile1</option>
> <option value="2">Zeile2</option>
> <option value="3">Zeile3</option>
> </select>
> </td>
> </tr>
> </table>
> </form>
> <script language="JavaScript">
> <!--
> function beforeSubmit(){
> document.ProductForm.scrollposition.value=self.pageYOffset;
> document.ProductForm.last_uri.value=document.ProductForm.currenturi.value;
> }
> // -->
> </script> 
> 
> Recording to ants-debug output the classes of js.jar are found:
> [...]
> Class org.mozilla.javascript.TokenStream loaded from ant loader
> Finding class org.mozilla.javascript.ObjToIntMap
> Class org.mozilla.javascript.ObjToIntMap loaded from ant loader
> Finding class org.mozilla.javascript.LabelTable
> Class org.mozilla.javascript.LabelTable loaded from ant loader
> Finding class org.mozilla.javascript.ClassNameHelper
> Class org.mozilla.javascript.ClassNameHelper loaded from ant loader
> Finding class org.mozilla.javascript.ClassRepository
> Class org.mozilla.javascript.ClassRepository loaded from ant loader
> Finding class org.mozilla.javascript.optimizer.OptClassNameHelper
> Class org.mozilla.javascript.optimizer.OptClassNameHelper loaded from ant
> loader
> [...] 
> 
> Any hints ? 
> 
> Regards,
> Michael 
> 
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest