[Webtest] a problem with setSelectField

webtest@lists.canoo.com webtest@lists.canoo.com
Fri, 14 Oct 2005 18:02:18 -0400


This is a multipart message in MIME format.
--=_alternative 00790F6F8525709A_=
Content-Type: text/plain; charset="us-ascii"

I have the following HTML form where two select fields are named the same

 <form>
     <select name="ynList" size="1" id="ynList">
        <option value="Yes" selected="selected">Yes</option>
        <option value="Yes">No</option>
     </select>
     <select name="ynList" size="1" id="ynList">
        <option value="Yes">Yes</option>
        <option value="No" selected="selected">No</option>
     </select>
   </form>

The following  step, checking for the text in the second select box 
(fieldIndex=1), works without problems.

<verifySelectField  description="verify 2nd select field"  name="arrControlGroup" text="No" fieldIndex="1"/>

but an attempt to set a value in the same select box using the same 
fieldIndex=1

<setSelectField  description="set 2nd select field"  name="arrControlGroup" text="Yes" fieldIndex="1"/>

fails with a message "com.canoo.webtest.engine.StepFailedException: Can't set field with index 
'1', valid range is 0..0, Step: SetSelectField".

Is this a bug or I'm doing something wrong? How do I select 'Yes' in the 
second select field?

- Ilya Preygel

--=_alternative 00790F6F8525709A_=
Content-Type: text/html; charset="us-ascii"


<br><font size=2 face="sans-serif">I have the following HTML form where two select fields are named the same</font>
<br>
<br><font size=2 face="Courier New">&nbsp;</font><font size=2 color=#008080 face="Courier New">&lt;</font><font size=2 color=#3f8080 face="Courier New">form</font><font size=2 color=#008080 face="Courier New">&gt;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp;</font><font size=2 color=#008080 face="Courier New">&lt;</font><font size=2 color=#3f8080 face="Courier New">select </font><font size=2 color=#800080 face="Courier New">name</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;ynList&quot; </font><font size=2 color=#800080 face="Courier New">size</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;1&quot; </font><font size=2 color=#800080 face="Courier New">id</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;ynList&quot;</font><font size=2 color=#008080 face="Courier New">&gt;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#008080 face="Courier New">&lt;</font><font size=2 color=#3f8080 face="Courier New">option </font><font size=2 color=#800080 face="Courier New">value</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;Yes&quot; </font><font size=2 color=#800080 face="Courier New">selected</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;selected&quot;</font><font size=2 color=#008080 face="Courier New">&gt;</font><font size=2 face="Courier New">Yes</font><font size=2 color=#008080 face="Courier New">&lt;/</font><font size=2 color=#3f8080 face="Courier New">option</font><font size=2 color=#008080 face="Courier New">&gt;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#008080 face="Courier New">&lt;</font><font size=2 color=#3f8080 face="Courier New">option </font><font size=2 color=#800080 face="Courier New">value</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;Yes&quot;</font><font size=2 color=#008080 face="Courier New">&gt;</font><font size=2 face="Courier New">No</font><font size=2 color=#008080 face="Courier New">&lt;/</font><font size=2 color=#3f8080 face="Courier New">option</font><font size=2 color=#008080 face="Courier New">&gt;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp;</font><font size=2 color=#008080 face="Courier New">&lt;/</font><font size=2 color=#3f8080 face="Courier New">select</font><font size=2 color=#008080 face="Courier New">&gt;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp;</font><font size=2 color=#008080 face="Courier New">&lt;</font><font size=2 color=#3f8080 face="Courier New">select </font><font size=2 color=#800080 face="Courier New">name</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;ynList&quot; </font><font size=2 color=#800080 face="Courier New">size</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;1&quot; </font><font size=2 color=#800080 face="Courier New">id</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;ynList&quot;</font><font size=2 color=#008080 face="Courier New">&gt;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#008080 face="Courier New">&lt;</font><font size=2 color=#3f8080 face="Courier New">option </font><font size=2 color=#800080 face="Courier New">value</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;Yes&quot;</font><font size=2 color=#008080 face="Courier New">&gt;</font><font size=2 face="Courier New">Yes</font><font size=2 color=#008080 face="Courier New">&lt;/</font><font size=2 color=#3f8080 face="Courier New">option</font><font size=2 color=#008080 face="Courier New">&gt;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#008080 face="Courier New">&lt;</font><font size=2 color=#3f8080 face="Courier New">option </font><font size=2 color=#800080 face="Courier New">value</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;No&quot; </font><font size=2 color=#800080 face="Courier New">selected</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;selected&quot;</font><font size=2 color=#008080 face="Courier New">&gt;</font><font size=2 face="Courier New">No</font><font size=2 color=#008080 face="Courier New">&lt;/</font><font size=2 color=#3f8080 face="Courier New">option</font><font size=2 color=#008080 face="Courier New">&gt;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp;</font><font size=2 color=#008080 face="Courier New">&lt;/</font><font size=2 color=#3f8080 face="Courier New">select</font><font size=2 color=#008080 face="Courier New">&gt;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp;</font><font size=2 color=#008080 face="Courier New">&lt;/</font><font size=2 color=#3f8080 face="Courier New">form</font><font size=2 color=#008080 face="Courier New">&gt;</font>
<br>
<br><font size=2 face="sans-serif">The following &nbsp;step, checking for the text in the second select box (fieldIndex=1), works without problems.</font>
<br>
<br><font size=2 color=#008080 face="Courier New">&lt;</font><font size=2 color=#3f8080 face="Courier New">verifySelectField &nbsp;</font><font size=2 color=#800080 face="Courier New">description</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;verify 2nd select field&quot; &nbsp;</font><font size=2 color=#800080 face="Courier New">name</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;arrControlGroup&quot; </font><font size=2 color=#800080 face="Courier New">text</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;No&quot; </font><font size=2 color=#800080 face="Courier New">fieldIndex</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;1&quot;</font><font size=2 color=#008080 face="Courier New">/&gt;</font>
<br>
<br><font size=2 face="sans-serif">but an attempt to set a value in the same select box using the same fieldIndex=1</font>
<br>
<br><font size=2 color=#008080 face="Courier New">&lt;</font><font size=2 color=#3f8080 face="Courier New">setSelectField &nbsp;</font><font size=2 color=#800080 face="Courier New">description</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;set 2nd select field&quot; &nbsp;</font><font size=2 color=#800080 face="Courier New">name</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;arrControlGroup&quot; </font><font size=2 color=#800080 face="Courier New">text</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;Yes&quot; </font><font size=2 color=#800080 face="Courier New">fieldIndex</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New">&quot;1&quot;</font><font size=2 color=#008080 face="Courier New">/&gt;</font>
<br>
<br><font size=2 face="sans-serif">fails with a message </font><font size=3 face="Times New Roman">&quot;com.canoo.webtest.engine.StepFailedException: Can't set field with index '1', valid range is 0..0, Step: SetSelectField&quot;.</font>
<br>
<br><font size=2 face="sans-serif">Is this a bug or I'm doing something wrong? How do I select 'Yes' in the second select field?</font>
<br>
<br><font size=2 face="sans-serif">- Ilya Preygel</font>
<br>
--=_alternative 00790F6F8525709A_=--