[Webtest] JavaScript dropdown+AJAX

Vishal Pai Vishal Pai <vishalpai@live.com>
Thu, 17 Jul 2008 15:57:27 +0530


--_b1c34a85-cc20-4f64-b674-a97be782714c_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Hi=2C
I am working with a country dropdown list in JS which triggers on selection=
 a AJAX code to populate a field below it .

The piece of source looks like this.

<select name=3D"CountryId" onchange=3D"javascript:getAlignmentName()" style=
=3D"50%"><option value=3D"" selected=3D"selected">&nbsp=3B
&nbsp=3B</option>
						<option value=3D"243">Brazil</option>
<option value=3D"244">Chile</option>
<option value=3D"245">China</option>
<option value=3D"268">India</option>
<option value=3D"246">Egypt</option>
</select>
			</td>
				<td></td>

>From the WebTest recorder=2CI select the Country as Brazil but I get the sc=
ript as :

<setSelectField name=3D"CountryId" text=3D"Brazil"/>

which is  not good enough for WebTest to parse through.

So=2Cas seen in the example in docs(http://webtest.canoo.com/webtest/manual=
/setSelectField.html)=2CI tweaked it to=20

<setInputField description=3D"Select a country: *" name=3D"CountryId" value=
=3D"Brazil"> </setInputField>

My test now read like this=20

<webtest name=3D"Test1- SR2.0">
        <config>
        <option name=3D"ThrowExceptionOnScriptError" value=3D"false" />
        </config>=20
            <invoke url=3D"http://10.12.91.213:7001/sr2/login.do" descripti=
on=3D"Login "/>
            <verifyTitle text=3D"Home"/>          =20
            <setInputField description=3D"Select a country: *" name=3D"Coun=
tryId" value=3D"Brazil"> </setInputField>
            <setInputField name=3D"alignmentVO.operatorName" value=3D"Delta=
"/>
            <clickButton label=3D"Next"/>
            <verifyText description=3D"Verify that text is contained in the=
 page" text=3D"Brazil "/>
            <verifyText description=3D"Verify that text is contained in the=
 page" text=3D"Delta-Brazil"/>

</webtest>

Even this script doesn't get through successfully.
I am not sure what's going wrong in here.

Has anyone got around a similiar issue?

Regards=2C
Vishal





_________________________________________________________________
Wish to Marry Now? Click Here to Register FREE
http://www.shaadi.com/registration/user/index.php?ptnr=3Dmhottag=

--_b1c34a85-cc20-4f64-b674-a97be782714c_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<style>
.hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt=3B
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class=3D'hmmessage'>
Hi=2C<br>I am working with a country dropdown list in JS which triggers on =
selection a AJAX code to populate a field below it .<br><br>The piece of so=
urce looks like this.<br><br><pre id=3D"line323">&lt=3B<span class=3D"start=
-tag">select</span><span class=3D"attribute-name"> name</span>=3D<span clas=
s=3D"attribute-value">"CountryId" </span><span class=3D"attribute-name">onc=
hange</span>=3D<span class=3D"attribute-value">"javascript:getAlignmentName=
()" </span><span class=3D"attribute-name">style</span>=3D<span class=3D"att=
ribute-value">"50%"</span>&gt=3B&lt=3B<span class=3D"start-tag">option</spa=
n><span class=3D"attribute-name"> value</span>=3D<span class=3D"attribute-v=
alue">"" </span><span class=3D"attribute-name">selected</span>=3D<span clas=
s=3D"attribute-value">"selected"</span>&gt=3B&amp=3B<span class=3D"entity">=
nbsp=3B</span><br>&amp=3B<span class=3D"entity">nbsp=3B</span>&lt=3B/<span =
class=3D"end-tag">option</span>&gt=3B<br>						&lt=3B<span class=3D"start-t=
ag">option</span><span class=3D"attribute-name"> value</span>=3D<span class=
=3D"attribute-value">"243"</span>&gt=3BBrazil&lt=3B/<span class=3D"end-tag"=
>option</span>&gt=3B<br>&lt=3B<span class=3D"start-tag">option</span><span =
class=3D"attribute-name"> value</span>=3D<span class=3D"attribute-value">"2=
44"</span>&gt=3BChile&lt=3B/<span class=3D"end-tag">option</span>&gt=3B<br>=
&lt=3B<span class=3D"start-tag">option</span><span class=3D"attribute-name"=
> value</span>=3D<span class=3D"attribute-value">"245"</span>&gt=3BChina&lt=
=3B/<span class=3D"end-tag">option</span>&gt=3B<br>&lt=3B<span class=3D"sta=
rt-tag">option</span><span class=3D"attribute-name"> value</span>=3D<span c=
lass=3D"attribute-value">"268"</span>&gt=3BIndia&lt=3B/<span class=3D"end-t=
ag">option</span>&gt=3B<br>&lt=3B<span class=3D"start-tag">option</span><sp=
an class=3D"attribute-name"> value</span>=3D<span class=3D"attribute-value"=
>"246"</span>&gt=3BEgypt&lt=3B/<span class=3D"end-tag">option</span>&gt=3B<=
br>&lt=3B/<span class=3D"end-tag">select</span>&gt=3B<br>			&lt=3B/<span cl=
ass=3D"end-tag">td</span>&gt=3B<br>				&lt=3B<span class=3D"start-tag">td</=
span>&gt=3B&lt=3B/<span class=3D"end-tag">td</span>&gt=3B<br></pre><br>From=
 the WebTest recorder=2CI select the Country as Brazil but I get the script=
 as :<br><br>&lt=3BsetSelectField name=3D"CountryId" text=3D"Brazil"/&gt=3B=
<br><br>which is&nbsp=3B not good enough for WebTest to parse through.<br><=
br>So=2Cas seen in the example in docs(http://webtest.canoo.com/webtest/man=
ual/setSelectField.html)=2CI tweaked it to <br><br>&lt=3BsetInputField desc=
ription=3D"Select a country: *" name=3D"CountryId" value=3D"Brazil"&gt=3B &=
lt=3B/setInputField&gt=3B<br><br>My test now read like this <br><br>&lt=3Bw=
ebtest name=3D"Test1- SR2.0"&gt=3B<br>&nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbs=
p=3B&nbsp=3B &lt=3Bconfig&gt=3B<br>&nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=
=3B&nbsp=3B &lt=3Boption name=3D"ThrowExceptionOnScriptError" value=3D"fals=
e" /&gt=3B<br>&nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &lt=3B/conf=
ig&gt=3B <br>&nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbs=
p=3B&nbsp=3B &lt=3Binvoke url=3D"http://10.12.91.213:7001/sr2/login.do" des=
cription=3D"Login "/&gt=3B<br>&nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbs=
p=3B &nbsp=3B&nbsp=3B&nbsp=3B &lt=3BverifyTitle text=3D"Home"/&gt=3B&nbsp=
=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B <br>&nbsp=3B&=
nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &lt=3Bset=
InputField description=3D"Select a country: *" name=3D"CountryId" value=3D"=
Brazil"&gt=3B &lt=3B/setInputField&gt=3B<br>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B &lt=3BsetInputF=
ield name=3D"alignmentVO.operatorName" value=3D"Delta"/&gt=3B<br>&nbsp=3B&n=
bsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B &lt=3BclickButton label=3D"Next"/&gt=3B<br>&nbsp=3B&nbsp=3B&nbsp=3B &nb=
sp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &lt=3BverifyText description=
=3D"Verify that text is contained in the page" text=3D"Brazil "/&gt=3B<br>&=
nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &=
lt=3BverifyText description=3D"Verify that text is contained in the page" t=
ext=3D"Delta-Brazil"/&gt=3B<br><br>&lt=3B/webtest&gt=3B<br><br>Even this sc=
ript doesn't get through successfully.<br>I am not sure what's going wrong =
in here.<br><br>Has anyone got around a similiar issue?<br><br>Regards=2C<b=
r>Vishal<br><br><br><br><br><br /><hr />Check news=2C cricket=2C entertainm=
ent and astrology right from your mobile. Browse http://m.msnindia.com from=
 your GPRS mobile phone. <a href=3D'http://m.msnindia.com' target=3D'_new'>=
Try it now!</a></body>
</html>=

--_b1c34a85-cc20-4f64-b674-a97be782714c_--