[Webtest] GETs on hrefs in form when clickbutton

Glen Cordrey webtest@lists.canoo.com
Tue, 10 Feb 2004 13:02:05 -0500


This is a multi-part message in MIME format.

------_=_NextPart_001_01C3EFFF.FE3096F6
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I have a <form that contains 1 field and many href's to Struts .do's, as =
shown
below (yes, there's no need for the href's to be inside the form, but =
that's how it is
and I can't change it). When I use clickbutton to submit the form (Ant =
snippet below)
Webtest first does GETs for each of the hrefs in the form, then does the =
POST. If I=20
exercise the form manually GETs for the hrefs aren't done, and when =
Webtest does
them failures result because the GETs seem to have thrown off the =
servlet's state.
So, a couple of questions:
=20
 1. Is the Ant snippet correct, or should I be doing something =
different?
 2. Assuming I can't change the form, is there a way for me in Webtest =
to submit
     the form, via clickbutton or any other mechnism, without triggering =
the GETs that
     result from the hrefs?
=20
=20
<!-- example of form containing hrefs -->
=20
  <form name=3D"myForm"  id=3D"queryForm"
    action=3D"execQuery.do" method=3D"POST">
...
      <a href=3D"someAction.do" ... >
...
      <!-- actual form field and image button -->
      <input name=3D"queryString" type=3D"text" size=3D"48" value=3D"" =
testID=3D"input_queryString"/>
      <input type=3D"image" name=3D"myButton" id=3D"imgSearch"=20
                   src=3D"images/local/btn_search.gif" =
testID=3D"input_image_submitSearch" alt=3D"search" >
..
     < href=3D"anotherAction.do" ...?
  </form>
=20
=20
Ant snippet submitting the form:
=20
 <setinputfield
     stepid=3D"Submit search form"
     name=3D"queryString"
     value=3D"congress" />
  <clickbutton stepid=3D"exec query" name=3D"myButton">
               <form name=3D"myForm" />
    </clickbutton>
  _____ =20


Glen Cordrey                 Convera             =20

voice: (410) 740-8800 x1150   http://www.convera.com =
<http://www.convera.com/>=20
fax:    (410) 740-8810
=20
=20

------_=_NextPart_001_01C3EFFF.FE3096F6
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D933254717-10022004>I have =
a &lt;form=20
that contains 1 field and many href's to Struts .do's, as=20
shown</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D933254717-10022004>below=20
</SPAN></FONT><FONT face=3DArial size=3D2><SPAN =
class=3D933254717-10022004>(yes,=20
there's no need for the href's to be inside the form, but that's how it=20
is</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D933254717-10022004>and I =
can't change=20
it). When I use clickbutton to submit the form (Ant snippet=20
below)</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D933254717-10022004>Webtest first=20
</SPAN></FONT><FONT face=3DArial size=3D2><SPAN =
class=3D933254717-10022004>does GETs=20
for each of the hrefs in the form, then does the POST. If I =
</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D933254717-10022004>exercise the form=20
manually GETs for the hrefs aren't done, and when Webtest=20
does</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D933254717-10022004>them =
failures result=20
because the GETs seem to have thrown off the servlet's=20
state.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D933254717-10022004>So, a =
couple of=20
questions:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D933254717-10022004>&nbsp;1. Is the Ant=20
snippet correct, or should I be doing something =
different?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D933254717-10022004>&nbsp;2. Assuming I=20
can't change the form, is there a way for me in Webtest to=20
submit</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004>&nbsp;&nbsp;&nbsp;&nbsp; the form, via =
clickbutton or=20
any other mechnism, without triggering the GETs that</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004>&nbsp;&nbsp;&nbsp;&nbsp; result from the=20
hrefs?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D933254717-10022004>&lt;!-- example of=20
form containing hrefs --&gt;</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D933254717-10022004>&nbsp; =
&lt;form=20
name=3D"myForm"&nbsp; id=3D"queryForm"<BR>&nbsp;&nbsp;&nbsp; =
action=3D"execQuery.do"=20
method=3D"POST"&gt;</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004>...</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;a=20
href=3D"someAction.do" ... &gt;</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004>...</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- actual =
form=20
field and image button --&gt;</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input=20
name=3D"queryString" type=3D"text" size=3D"48" value=3D""=20
testID=3D"input_queryString"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;input=20
type=3D"image" name=3D"myButton" id=3D"imgSearch" </SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
src=3D"images/local/btn_search.gif" testID=3D"input_image_submitSearch" =
alt=3D"search"=20
&gt;</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004>..</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004>&nbsp;&nbsp;&nbsp;&nbsp; &lt; =
href=3D"anotherAction.do"=20
...?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D933254717-10022004>&nbsp; =

&lt;/form&gt;</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D933254717-10022004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D933254717-10022004><FONT face=3DArial size=3D2>Ant =
snippet=20
submitting the form:</FONT></SPAN></DIV>
<DIV><SPAN class=3D933254717-10022004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2>&nbsp;&lt;setinputfield<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stepid=3D=
"<SPAN=20
class=3D933254717-10022004>Submit search=20
form</SPAN>"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name=3D"queryString"<BR>&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;value=3D"congress"=20
/&gt;<BR>&nbsp;&nbsp;&lt;clickbutton stepid=3D"exec query" name=3D"<SPAN =

class=3D933254717-10022004>myButton</SPAN>"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;f=
orm=20
name=3D"<SPAN class=3D933254717-10022004>my</SPAN>Form"=20
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/clickbutton&gt;</FONT></DIV>
<DIV>
<HR>

<P><FONT face=3DArial><FONT size=3D3><FONT color=3D#808000><STRONG>Glen=20
Cordrey&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;<FONT=20
color=3D#000000>&nbsp;&nbsp;Convera</FONT></STRONG></FONT>&nbsp;</FONT>&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2>voice: (410) 740-8800 =
x1150&nbsp;&nbsp;<A=20
href=3D"http://www.convera.com/">http://www.convera.com</A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>fax:&nbsp;&nbsp;&nbsp; (410) =
740-8810</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------_=_NextPart_001_01C3EFFF.FE3096F6--