[Webtest] JavaScript dropdown+AJAX

Meng, Lily Meng, Lily" <lmeng@pointserve.com
Thu, 17 Jul 2008 09:23:03 -0500


--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB1844F46491SGPEXCHANGEpo_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi Vishal,


I have encountered similar issue before.
If the optoin value "243","244"... aren't dynamic, give this a try.
<setSelectField name=3D"CountryId" value=3D"243" description=3D"select Braz=
il"/>

Hope that helps.
Lily




________________________________
From: webtest-admin@lists.canoo.com [mailto:webtest-admin@lists.canoo.com] =
On Behalf Of Vishal Pai
Sent: Thursday, July 17, 2008 5:27 AM
To: webtest@lists.canoo.com
Subject: [Webtest] JavaScript dropdown+AJAX

Hi,
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;

&nbsp;</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,I select the Country as Brazil but I get the scri=
pt as :

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

which is  not good enough for WebTest to parse through.

So,as seen in the example in docs(http://webtest.canoo.com/webtest/manual/s=
etSelectField.html),I tweaked it to

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

My test now read like this

<webtest name=3D"Test1- SR2.0">
        <config>
        <option name=3D"ThrowExceptionOnScriptError" value=3D"false" />
        </config>
            <invoke url=3D"http://10.12.91.213:7001/sr2/login.do" descripti=
on=3D"Login "/>
            <verifyTitle text=3D"Home"/>
            <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,
Vishal




________________________________
Check news, cricket, entertainment and astrology right from your mobile. Br=
owse http://m.msnindia.com from your GPRS mobile phone. Try it now!<http://=
m.msnindia.com>

--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB1844F46491SGPEXCHANGEpo_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" xmlns=3D"http://ww=
w.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"countr=
y-region"/>
<o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
 name=3D"City"/>
<o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
 name=3D"place"/>
<o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
 name=3D"PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:blue;
	text-decoration:underline;}
p
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman";}
pre
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
span.EmailStyle24
	{mso-style-type:personal-reply;
	font-family:Arial;
	color:navy;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dblue>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Hi Vishal<st1:PersonName w:st=3D"on">,=
</st1:PersonName><o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'>I have encountered similar issue befor=
e.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'>If the optoin value &#8220;243&#8221;<=
st1:PersonName
w:st=3D"on">,</st1:PersonName>&#8221;244&#8221;&#8230; aren&#8217;t dynamic=
<st1:PersonName
w:st=3D"on">,</st1:PersonName> give this a try.<o:p></o:p></span></font></p=
>

<p class=3DMsoNormal><font size=3D2 face=3DTahoma><span style=3D'font-size:=
10.0pt;
font-family:Tahoma'>&lt;setSelectField name=3D&quot;CountryId&quot; value=
=3D&quot;243&quot;
description=3D&#8221;select <st1:country-region w:st=3D"on"><st1:place w:st=
=3D"on">Brazil</st1:place></st1:country-region>&#8221;/&gt;</span></font><f=
ont
size=3D2 color=3Dnavy face=3DArial><span style=3D'font-size:10.0pt;font-fam=
ily:Arial;
color:navy'><o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Hope that helps.<o:p></o:p></span></fo=
nt></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Lily<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font siz=
e=3D3
face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>

<hr size=3D2 width=3D"100%" align=3Dcenter tabindex=3D-1>

</span></font></div>

<p class=3DMsoNormal><b><font size=3D2 face=3DTahoma><span style=3D'font-si=
ze:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=3D2
face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'> webtest-=
admin@lists.canoo.com
[mailto:webtest-admin@lists.canoo.com] <b><span style=3D'font-weight:bold'>=
On
Behalf Of </span></b>Vishal Pai<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Thursday<st1:PersonNam=
e
w:st=3D"on">,</st1:PersonName> July 17<st1:PersonName w:st=3D"on">,</st1:Pe=
rsonName>
2008 5:27 AM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> <st1:PersonName w:st=3D"=
on">webtest@lists.canoo.com</st1:PersonName><br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> [Webtest] JavaScrip=
t
dropdown+<st1:City w:st=3D"on"><st1:place w:st=3D"on">AJAX</st1:place></st1=
:City></span></font><o:p></o:p></p>

</div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span style=3D=
'font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DTahoma><span style=3D'font-size:=
10.0pt;
font-family:Tahoma'>Hi<st1:PersonName w:st=3D"on">,</st1:PersonName><br>
I am working with a country dropdown list in JS which triggers on selection=
 a <st1:City
w:st=3D"on"><st1:place w:st=3D"on">AJAX</st1:place></st1:City> code to popu=
late a
field below it .<br>
<br>
The piece of source looks like this.<br>
<br>
<br>
<o:p></o:p></span></font></p>

<pre><font size=3D2 face=3D"Courier New"><span style=3D'font-size:10.0pt'>&=
lt;<span
class=3Dstart-tag>select</span><span class=3Dattribute-name> name</span>=3D=
<span
class=3Dattribute-value>&quot;CountryId&quot; </span><span class=3Dattribut=
e-name>onchange</span>=3D<span
class=3Dattribute-value>&quot;javascript:getAlignmentName()&quot; </span><s=
pan
class=3Dattribute-name>style</span>=3D<span class=3Dattribute-value>&quot;5=
0%&quot;</span>&gt;&lt;<span
class=3Dstart-tag>option</span><span class=3Dattribute-name> value</span>=
=3D<span
class=3Dattribute-value>&quot;&quot; </span><span class=3Dattribute-name>se=
lected</span>=3D<span
class=3Dattribute-value>&quot;selected&quot;</span>&gt;&amp;<span class=3De=
ntity>nbsp;</span><br>
&amp;<span class=3Dentity>nbsp;</span>&lt;/<span class=3Dend-tag>option</sp=
an>&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=3Dstart-tag>option</span><span class=3Dattribute-name> value</span>=
=3D<span
class=3Dattribute-value>&quot;243&quot;</span>&gt;<st1:country-region w:st=
=3D"on"><st1:place
 w:st=3D"on">Brazil</st1:place></st1:country-region>&lt;/<span class=3Dend-=
tag>option</span>&gt;<br>
&lt;<span class=3Dstart-tag>option</span><span class=3Dattribute-name> valu=
e</span>=3D<span
class=3Dattribute-value>&quot;244&quot;</span>&gt;<st1:country-region w:st=
=3D"on"><st1:place
 w:st=3D"on">Chile</st1:place></st1:country-region>&lt;/<span class=3Dend-t=
ag>option</span>&gt;<br>
&lt;<span class=3Dstart-tag>option</span><span class=3Dattribute-name> valu=
e</span>=3D<span
class=3Dattribute-value>&quot;245&quot;</span>&gt;<st1:country-region w:st=
=3D"on"><st1:place
 w:st=3D"on">China</st1:place></st1:country-region>&lt;/<span class=3Dend-t=
ag>option</span>&gt;<br>
&lt;<span class=3Dstart-tag>option</span><span class=3Dattribute-name> valu=
e</span>=3D<span
class=3Dattribute-value>&quot;268&quot;</span>&gt;<st1:country-region w:st=
=3D"on"><st1:place
 w:st=3D"on">India</st1:place></st1:country-region>&lt;/<span class=3Dend-t=
ag>option</span>&gt;<br>
&lt;<span class=3Dstart-tag>option</span><span class=3Dattribute-name> valu=
e</span>=3D<span
class=3Dattribute-value>&quot;246&quot;</span>&gt;<st1:country-region w:st=
=3D"on"><st1:place
 w:st=3D"on">Egypt</st1:place></st1:country-region>&lt;/<span class=3Dend-t=
ag>option</span>&gt;<br>
&lt;/<span class=3Dend-tag>select</span>&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<span
class=3Dend-tag>td</span>&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=3Dstart-tag>td</span>&gt;&lt;/<span class=3Dend-tag>td</span>&gt;<o:p=
></o:p></span></font></pre>

<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><font size=3D2 face=3DT=
ahoma><span
style=3D'font-size:10.0pt;font-family:Tahoma'><br>
>From the WebTest recorder<st1:PersonName w:st=3D"on">,</st1:PersonName>I se=
lect
the Country as <st1:country-region w:st=3D"on"><st1:place w:st=3D"on">Brazi=
l</st1:place></st1:country-region>
but I get the script as :<br>
<br>
&lt;setSelectField name=3D&quot;CountryId&quot; text=3D&quot;<st1:country-r=
egion
w:st=3D"on"><st1:place w:st=3D"on">Brazil</st1:place></st1:country-region>&=
quot;/&gt;<br>
<br>
which is&nbsp; not good enough for WebTest to parse through.<br>
<br>
So<st1:PersonName w:st=3D"on">,</st1:PersonName>as seen in the example in
docs(http://webtest.canoo.com/webtest/manual/setSelectField.html)<st1:Perso=
nName
w:st=3D"on">,</st1:PersonName>I tweaked it to <br>
<br>
&lt;setInputField description=3D&quot;Select a country: *&quot;
name=3D&quot;CountryId&quot; value=3D&quot;<st1:country-region w:st=3D"on">=
<st1:place
 w:st=3D"on">Brazil</st1:place></st1:country-region>&quot;&gt;
&lt;/setInputField&gt;<br>
<br>
My test now read like this <br>
<br>
&lt;webtest name=3D&quot;Test1- SR2.0&quot;&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;config&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;option name=3D&quot;ThrowExceptio=
nOnScriptError&quot;
value=3D&quot;false&quot; /&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/config&gt; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;invoke
url=3D&quot;http://10.12.91.213:7001/sr2/login.do&quot; description=3D&quot=
;Login
&quot;/&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;verifyTitle
text=3D&quot;Home&quot;/&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nb=
sp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;setInputField
description=3D&quot;Select a country: *&quot; name=3D&quot;CountryId&quot;
value=3D&quot;<st1:country-region w:st=3D"on"><st1:place w:st=3D"on">Brazil=
</st1:place></st1:country-region>&quot;&gt;
&lt;/setInputField&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;setInputField name=3D&quot;alignmentVO.operatorName&quot;
value=3D&quot;Delta&quot;/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;clickButton label=3D&quot;Next&quot;/&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;verifyText
description=3D&quot;Verify that text is contained in the page&quot; text=3D=
&quot;<st1:country-region
w:st=3D"on"><st1:place w:st=3D"on">Brazil</st1:place></st1:country-region>
&quot;/&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;verifyText
description=3D&quot;Verify that text is contained in the page&quot;
text=3D&quot;Delta-Brazil&quot;/&gt;<br>
<br>
&lt;/webtest&gt;<br>
<br>
Even this script 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<st1:PersonName w:st=3D"on">,</st1:PersonName><br>
Vishal<br>
<br>
<br>
<br>
<br>
<o:p></o:p></span></font></p>

<div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font siz=
e=3D2
face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'>

<hr size=3D2 width=3D"100%" align=3Dcenter>

</span></font></div>

<p class=3DMsoNormal><font size=3D2 face=3DTahoma><span style=3D'font-size:=
10.0pt;
font-family:Tahoma'>Check news<st1:PersonName w:st=3D"on">,</st1:PersonName=
>
cricket<st1:PersonName w:st=3D"on">,</st1:PersonName> entertainment and ast=
rology
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><o:=
p></o:p></span></font></p>

</div>

</body>

</html>

--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB1844F46491SGPEXCHANGEpo_--