[Webtest] No option found matching criteria in select - Disabled

Troy Wilkes webtest@lists.canoo.com
Fri, 2 Jun 2006 08:58:43 -0700


Hey Mittie,
 
Here is the html, where they cannot pick a list element until element "user"
has a character entered:
<html>
 <head>
 </head>
 <body>
  <input type="text" name="user" id="user"
onkeyup="document.getElementById('list').disabled=false" />
  <p />
  <select name="list" id="list" disabled="disabled">
   <option value="US">US</option>
   <option value="Other">Other</option>
  </select>
 </body>
</html>

A WebTest would enter a name and then set the list value, but since it is
done onkeyup nothing happens and it cannot find an element in the disabled
select. I had a problem like this with an input and used
"emulateSetInputFieldAttribute" to programmatically enable the input field.
So, I was inquiring if there is similar functionality to enable a select.
 <target name="test.mock">
  <webtest name="test">
   <config 
     host="localhost"
     port="8080"
     protocol="http"
     basepath="HelloWorld" />
   <steps>
    <invoke
     description="goto Test Page"
     url="/testSelectDisabled.htm" />
    <setInputField
     description="Set Select Enabled"
     name="user"
     value="Troy" />
    <setSelectField
     description="Select List"
     name="list" 
     value="US" />
   </steps>
  </webtest>
 </target>

Thanx,
Troy

------=_NextPart_000_0500_01C685F2.7B187CA0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR></HEAD> <BODY>
<DIV><SPAN class=3D679430210-02062006><FONT face=3DArial size=3D2>Hey=20
Mattie,</FONT></SPAN></DIV> <DIV><SPAN class=3D679430210-02062006><FONT
face=3DArial=20 size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D679430210-02062006><FONT face=3DArial size=3D2>Here = is
the html,=20 where they cannot pick a list element until user has a
character=20 entered:</FONT></SPAN></DIV> <DIV><SPAN
class=3D679430210-02062006><FONT face=3DArial=20
size=3D2>&lt;html&gt;<BR>&nbsp;&lt;head&gt;<BR>&nbsp;&lt;/head&gt;<BR>&nb=
sp;&lt;body&gt;<BR>&nbsp;&nbsp;&lt;input=20
type=3D"text" name=3D"user" id=3D"user"=20
onkeyup=3D"document.getElementById('list').disabled=3Dfalse"=20
/&gt;<BR>&nbsp;&nbsp;&lt;p /&gt;<BR>&nbsp;&nbsp;&lt;select name=3D"list" =
id=3D"list"=20 disabled=3D"disabled"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;option=20
value=3D"US"&gt;US&lt;/option&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;option=20
value=3D"Other"&gt;Other&lt;/option&gt;<BR>&nbsp;&nbsp;&lt;/select&gt;<BR=
>&nbsp;&lt;/body&gt;<BR>&lt;/html&gt;<BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D679430210-02062006><FONT face=3DArial size=3D2>A =
WebTest would=20 enter a name and then set the list value, but since it is
done onkeyup = nothing=20 happens and it cannot find an element in the
disabled select. I had a = problem=20 like this with an input and used
"</FONT><FONT face=3DArial><FONT=20
size=3D2>emulateSetInputFieldAttribute<SPAN class=3D679430210-02062006>" =

to&nbsp;programmatically enable the input field. So, I was inquiring if =
there is=20 similar functionality to enable a =
select.</SPAN></FONT></FONT></DIV></SPAN>
<DIV><SPAN class=3D679430210-02062006><FONT face=3DArial =
size=3D2>&nbsp;&lt;target=20
name=3D"test.mock"&gt;<BR>&nbsp;&nbsp;&lt;webtest=20
name=3D"test"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;config =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
host=3D"localhost"<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
port=3D"8080"<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
protocol=3D"http"<BR>&nbsp;&nbsp;&nbsp;&nbsp; basepath=3D"HelloWorld"=20
/&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;steps&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;i=
nvoke<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;description=3D"goto=20
Test =
Page"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url=3D"/testSelectDisabled.htm"=20
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;setInputField<BR>&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;description=3D"Set=20
Select=20
Enabled"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name=3D"user"<BR>&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;value=3D"Troy"=20
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;setSelectField<BR>&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;description=3D"Select=20
List"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name=3D"list"=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value=3D"US"=20
/&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;/steps&gt;<BR>&nbsp;&nbsp;&lt;/webtest&gt;=
<BR>&nbsp;&lt;/target&gt;<BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D679430210-02062006><FONT face=3DArial=20
size=3D2>Thanx,<BR>Troy</DIV></FONT></SPAN></BODY></HTML>

------=_NextPart_000_0500_01C685F2.7B187CA0--