views:

115

answers:

1

Hi, I'm having trouble running the following command to select a value in a drop down list using selenium IDE.


Command = Select Target = NumberOfAdultRecords Value = label=4


When i run the test above in sequence with the other commands in the test case, the value 4 is not selected in the drop down. If i select only that one command line and use the 'Find' feature it highlights the element and if i double click the command while the test is paused or stopped it successfully selects the 4th value.

I've sourced other explanations and found this http://stackoverflow.com/questions/2544336/selenium-onchange-not-working and i believe that i'm experiencing the same issue with the OnChange event.

Could some please help me write a test command to select the 4th value within the following code:

<div style="background-color: rgb(255, 204, 0); width: 66px; height: 35px; float: left;"><select onchange="javascript:updateCostsAdult(this.value);" id="NumberOfAdultRecords" name="NumberOfAdultRecords">
                            <option selected="" value="0">0</option>
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                      </select></div>

I would really appreciate any help

Cheers

Jules

A: 

You may try to use JavaScript to select the value:

http://wiki.openqa.org/display/SEL/eval

selenium.browserbot.getCurrentWindow().getElementById('you_select_id_here').selectedIndex=4

dmitko