[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 <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> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D933254717-10022004> 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> 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> 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> result from the=20
hrefs?</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></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D933254717-10022004><!-- example of=20
form containing hrefs --></SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D933254717-10022004> =
<form=20
name=3D"myForm" id=3D"queryForm"<BR> =
action=3D"execQuery.do"=20
method=3D"POST"></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> <a=20
href=3D"someAction.do" ... ></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> <!-- actual =
form=20
field and image button --></SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D933254717-10022004> <input=20
name=3D"queryString" type=3D"text" size=3D"48" value=3D""=20
testID=3D"input_queryString"/><BR> =
<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> &nbs=
p; =20
src=3D"images/local/btn_search.gif" testID=3D"input_image_submitSearch" =
alt=3D"search"=20
></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> < =
href=3D"anotherAction.do"=20
...?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D933254717-10022004> =
</form></SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><SPAN class=3D933254717-10022004><FONT face=3DArial=20
size=3D2></FONT></SPAN> </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> </DIV>
<DIV><FONT face=3DArial=20
size=3D2> <setinputfield<BR> stepid=3D=
"<SPAN=20
class=3D933254717-10022004>Submit search=20
form</SPAN>"<BR> name=3D"queryString"<BR>&nb=
sp; value=3D"congress"=20
/><BR> <clickbutton stepid=3D"exec query" name=3D"<SPAN =
class=3D933254717-10022004>myButton</SPAN>"><BR> &nbs=
p; <f=
orm=20
name=3D"<SPAN class=3D933254717-10022004>my</SPAN>Form"=20
/><BR> </clickbutton></FONT></DIV>
<DIV>
<HR>
<P><FONT face=3DArial><FONT size=3D3><FONT color=3D#808000><STRONG>Glen=20
Cordrey =
<FONT=20
color=3D#000000> Convera</FONT></STRONG></FONT> </FONT>&n=
bsp; &nb=
sp;</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2>voice: (410) 740-8800 =
x1150 <A=20
href=3D"http://www.convera.com/">http://www.convera.com</A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>fax: (410) =
740-8810</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------_=_NextPart_001_01C3EFFF.FE3096F6--