[Webtest] JavaScript dropdown+AJAX

Vishal Pai Vishal Pai <vishalpai@live.com>
Fri, 18 Jul 2008 11:34:36 +0530


--_bda4f6d6-39c5-4f37-8b94-cd298a478d1d_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable


Hi Lily=2C

The value 243=2C244 is not dynamic.
So i did try=2C
<setSelectField name=3D"CountryId" value=3D"243"
description=3D=94select Brazil=94/>


 but i get an error=20
error:No suitable form found having field named "CountryId"

But I figured that the page uses 2 HTML forms=2Cone for the menus at the to=
p and another below for the actual form to be filled in
The form below(2nd form)  has been framed as follows...
<form name=3D"alignmentForm" method=3D"post" action=3D"/sr2/alignMng.do" id=
=3D"alignForm">

Now the question is =2Chow do i get the script to recognise that there is a=
 second form on the page???

I googled to find the solution but found that a number of people are stuck =
up with this issue without a solution.

Any workarounds =2Canybody?

Regards=2C

Vishal
=20

From: lmeng@pointserve.com
To: vishalpai@live.com
CC: webtest@lists.canoo.com
Date: Thu=2C 17 Jul 2008 09:23:03 -0500
Subject: RE: [Webtest] JavaScript dropdown+AJAX

























Hi Vishal=2C

=20

=20

I have encountered similar issue before.

If the optoin value =93243=94=2C=94244=94=85 aren=92t dynamic=2C give this =
a try.

<setSelectField name=3D"CountryId" value=3D"243"
description=3D=94select Brazil=94/>

=20

Hope that helps.

Lily

=20

=20

=20

=20









From: webtest-admin@lists.canoo.com
[mailto:webtest-admin@lists.canoo.com] On
Behalf Of Vishal Pai

Sent: Thursday=2C July 17=2C
2008 5:27 AM

To: webtest@lists.canoo.com

Subject: [Webtest] JavaScript
dropdown+AJAX



=20

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 script 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 tweak=
ed 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" description=3D"Login
"/>

            <verifyTitle
text=3D"Home"/>          =20

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

          =20
<setInputField name=3D"alignmentVO.operatorName"
value=3D"Delta"/>

          =20
<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

















Check news=2C
cricket=2C entertainment and astrology
right from your mobile. Browse http://m.msnindia.com from your GPRS mobile
phone. Try it now!







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

--_bda4f6d6-39c5-4f37-8b94-cd298a478d1d_
Content-Type: text/html; charset="Windows-1252"
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 Lily=2C<br><br>The value 243=2C244 is not dynamic.<br>So i did try=2C<br=
><font size=3D"2" face=3D"Tahoma"><span style=3D"font-size: 10pt=3B font-fa=
mily: Tahoma=3B">&lt=3BsetSelectField name=3D"CountryId" value=3D"243"
description=3D=94select Brazil=94/&gt=3B<br><br><br></span></font>&nbsp=3Bb=
ut i get an error <br>error:No suitable form found having field named "Coun=
tryId"<br><br>But I figured that the page uses 2 HTML forms=2Cone for the m=
enus at the top and another below for the actual form to be filled in<br>Th=
e form below(2nd form)&nbsp=3B has been framed as follows...<br>&lt=3Bform =
name=3D"alignmentForm" method=3D"post" action=3D"/sr2/alignMng.do" id=3D"al=
ignForm"&gt=3B<br><br>Now the question is =2Chow do i get the script to rec=
ognise that there is a second form on the page???<br><br>I googled to find =
the solution but found that a number of people are stuck up with this issue=
 without a solution.<br><br>Any workarounds =2Canybody?<br><br>Regards=2C<b=
r><br>Vishal<br>&nbsp=3B<br><br><hr>From: lmeng@pointserve.com<br>To: visha=
lpai@live.com<br>CC: webtest@lists.canoo.com<br>Date: Thu=2C 17 Jul 2008 09=
:23:03 -0500<br>Subject: RE: [Webtest] JavaScript dropdown+AJAX<br><br>


<meta http-equiv=3D"Content-Type" content=3D"text/html=3B charset=3Dunicode=
">
<meta name=3D"Generator" content=3D"Microsoft SafeHTML">



<style>
.ExternalClass .EC_shape
{=3B}
</style>





<style>
</style>

<style>
.ExternalClass p.EC_MsoNormal=2C .ExternalClass li.EC_MsoNormal=2C .Externa=
lClass div.EC_MsoNormal
{margin-bottom:.0001pt=3Bfont-size:12.0pt=3Bfont-family:'Times New Roman'=
=3B}
.ExternalClass a:link=2C .ExternalClass span.EC_MsoHyperlink
{color:blue=3Btext-decoration:underline=3B}
.ExternalClass a:visited=2C .ExternalClass span.EC_MsoHyperlinkFollowed
{color:blue=3Btext-decoration:underline=3B}
.ExternalClass p
{margin-right:0in=3Bmargin-left:0in=3Bfont-size:12.0pt=3Bfont-family:'Times=
 New Roman'=3B}
.ExternalClass pre
{margin-bottom:.0001pt=3Bfont-size:10.0pt=3Bfont-family:'Courier New'=3B}
.ExternalClass span.EC_EmailStyle24
{font-family:Arial=3Bcolor:navy=3B}
@page Section1
{size:8.5in 11.0in=3B}
.ExternalClass div.EC_Section1
{page:Section1=3B}

</style>





<div class=3D"EC_Section1">

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">Hi Vi=
shal=2C</span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">&nbsp=
=3B</span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">&nbsp=
=3B</span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">I hav=
e encountered similar issue before.</span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">If th=
e optoin value =93243=94=2C=94244=94=85 aren=92t dynamic=2C give this a try=
.</span></font></p>

<p class=3D"EC_MsoNormal"><font size=3D"2" face=3D"Tahoma"><span style=3D"f=
ont-size: 10pt=3B font-family: Tahoma=3B">&lt=3BsetSelectField name=3D"Coun=
tryId" value=3D"243"
description=3D=94select Brazil=94/&gt=3B</span></font><font color=3D"navy" =
size=3D"2" face=3D"Arial"><span style=3D"font-size: 10pt=3B font-family: Ar=
ial=3B color: navy=3B"></span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">&nbsp=
=3B</span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">Hope =
that helps.</span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">Lily<=
/span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">&nbsp=
=3B</span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">&nbsp=
=3B</span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">&nbsp=
=3B</span></font></p>

<p class=3D"EC_MsoNormal"><font color=3D"navy" size=3D"2" face=3D"Arial"><s=
pan style=3D"font-size: 10pt=3B font-family: Arial=3B color: navy=3B">&nbsp=
=3B</span></font></p>

<div>

<div class=3D"EC_MsoNormal" style=3D"text-align: center=3B" align=3D"center=
"><font size=3D"3" face=3D"Times New Roman"><span style=3D"font-size: 12pt=
=3B">

<hr align=3D"center" size=3D"2" width=3D"100%">

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

<p class=3D"EC_MsoNormal"><b><font size=3D"2" face=3D"Tahoma"><span style=
=3D"font-size: 10pt=3B font-family: Tahoma=3B font-weight: bold=3B">From:</=
span></font></b><font size=3D"2" face=3D"Tahoma"><span style=3D"font-size: =
10pt=3B font-family: Tahoma=3B"> webtest-admin@lists.canoo.com
[mailto:webtest-admin@lists.canoo.com] <b><span style=3D"font-weight: bold=
=3B">On
Behalf Of </span></b>Vishal Pai<br>
<b><span style=3D"font-weight: bold=3B">Sent:</span></b> Thursday=2C July 1=
7=2C
2008 5:27 AM<br>
<b><span style=3D"font-weight: bold=3B">To:</span></b> webtest@lists.canoo.=
com<br>
<b><span style=3D"font-weight: bold=3B">Subject:</span></b> [Webtest] JavaS=
cript
dropdown+AJAX</span></font></p>

</div>

<p class=3D"EC_MsoNormal"><font size=3D"3" face=3D"Times New Roman"><span s=
tyle=3D"font-size: 12pt=3B">&nbsp=3B</span></font></p>

<p class=3D"EC_MsoNormal"><font size=3D"2" face=3D"Tahoma"><span style=3D"f=
ont-size: 10pt=3B font-family: Tahoma=3B">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 source looks like this.<br>
<br>
<br>
</span></font></p>

<pre><font size=3D"2" face=3D"Courier New"><span style=3D"font-size: 10pt=
=3B">&lt=3B<span class=3D"EC_start-tag">select</span><span class=3D"EC_attr=
ibute-name"> name</span>=3D<span class=3D"EC_attribute-value">"CountryId" <=
/span><span class=3D"EC_attribute-name">onchange</span>=3D<span class=3D"EC=
_attribute-value">"javascript:getAlignmentName()" </span><span class=3D"EC_=
attribute-name">style</span>=3D<span class=3D"EC_attribute-value">"50%"</sp=
an>&gt=3B&lt=3B<span class=3D"EC_start-tag">option</span><span class=3D"EC_=
attribute-name"> value</span>=3D<span class=3D"EC_attribute-value">"" </spa=
n><span class=3D"EC_attribute-name">selected</span>=3D<span class=3D"EC_att=
ribute-value">"selected"</span>&gt=3B&amp=3B<span class=3D"EC_entity">nbsp=
=3B</span><br><br>&amp=3B<span class=3D"EC_entity">nbsp=3B</span>&lt=3B/<sp=
an class=3D"EC_end-tag">option</span>&gt=3B<br><br>&nbsp=3B&nbsp=3B&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nb=
sp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nb=
sp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B &lt=3B<span class=3D"EC_start-tag">op=
tion</span><span class=3D"EC_attribute-name"> value</span>=3D<span class=3D=
"EC_attribute-value">"243"</span>&gt=3BBrazil&lt=3B/<span class=3D"EC_end-t=
ag">option</span>&gt=3B<br><br>&lt=3B<span class=3D"EC_start-tag">option</s=
pan><span class=3D"EC_attribute-name"> value</span>=3D<span class=3D"EC_att=
ribute-value">"244"</span>&gt=3BChile&lt=3B/<span class=3D"EC_end-tag">opti=
on</span>&gt=3B<br><br>&lt=3B<span class=3D"EC_start-tag">option</span><spa=
n class=3D"EC_attribute-name"> value</span>=3D<span class=3D"EC_attribute-v=
alue">"245"</span>&gt=3BChina&lt=3B/<span class=3D"EC_end-tag">option</span=
>&gt=3B<br><br>&lt=3B<span class=3D"EC_start-tag">option</span><span class=
=3D"EC_attribute-name"> value</span>=3D<span class=3D"EC_attribute-value">"=
268"</span>&gt=3BIndia&lt=3B/<span class=3D"EC_end-tag">option</span>&gt=3B=
<br><br>&lt=3B<span class=3D"EC_start-tag">option</span><span class=3D"EC_a=
ttribute-name"> value</span>=3D<span class=3D"EC_attribute-value">"246"</sp=
an>&gt=3BEgypt&lt=3B/<span class=3D"EC_end-tag">option</span>&gt=3B<br><br>=
&lt=3B/<span class=3D"EC_end-tag">select</span>&gt=3B<br><br>&nbsp=3B&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nb=
sp=3B&nbsp=3B &lt=3B/<span class=3D"EC_end-tag">td</span>&gt=3B<br><br>&nbs=
p=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nb=
sp=3B&nbsp=3B &lt=3B<span class=3D"EC_start-tag">td</span>&gt=3B&lt=3B/<spa=
n class=3D"EC_end-tag">td</span>&gt=3B</span></font></pre>

<p class=3D"EC_MsoNormal" style=3D"margin-bottom: 12pt=3B"><font size=3D"2"=
 face=3D"Tahoma"><span style=3D"font-size: 10pt=3B font-family: Tahoma=3B">=
<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/manual/setSelectField.html)=2CI tweak=
ed it to <br>
<br>
&lt=3BsetInputField description=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=3Bwebtest name=3D"Test1- SR2.0"&gt=3B<br>
&nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &lt=3Bconfig&gt=3B<br>
&nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &lt=3Boption name=3D"Thro=
wExceptionOnScriptError"
value=3D"false" /&gt=3B<br>
&nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &lt=3B/config&gt=3B <br>
&nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=3B =
&lt=3Binvoke
url=3D"http://10.12.91.213:7001/sr2/login.do" description=3D"Login
"/&gt=3B<br>
&nbsp=3B&nbsp=3B&nbsp=3B &nbsp=3B&nbsp=3B&nbsp=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=3BsetInputField
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&nb=
sp=3B&nbsp=3B
&lt=3BsetInputField name=3D"alignmentVO.operatorName"
value=3D"Delta"/&gt=3B<br>
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nb=
sp=3B&nbsp=3B
&lt=3BclickButton label=3D"Next"/&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" 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"
text=3D"Delta-Brazil"/&gt=3B<br>
<br>
&lt=3B/webtest&gt=3B<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=2C<br>
Vishal<br>
<br>
<br>
<br>
<br>
</span></font></p>

<div class=3D"EC_MsoNormal" style=3D"text-align: center=3B" align=3D"center=
"><font size=3D"2" face=3D"Tahoma"><span style=3D"font-size: 10pt=3B font-f=
amily: Tahoma=3B">

<hr align=3D"center" size=3D"2" width=3D"100%">

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

<p class=3D"EC_MsoNormal"><font size=3D"2" face=3D"Tahoma"><span style=3D"f=
ont-size: 10pt=3B font-family: Tahoma=3B">Check news=2C
cricket=2C entertainment 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"_blank">Try it now!</a><=
/span></font></p>

</div>




<br /><hr />Check news=2C cricket=2C entertainment 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>=

--_bda4f6d6-39c5-4f37-8b94-cd298a478d1d_--