Quantcast
Channel: Silk Test - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 625

Using HTML-select with option groups

$
0
0

Given the following HTML, I want to select an entry from a select component by its name.

<select id="1">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
</select>

<select id="2">
    <optgroup label="Swedish Cars">
        <option value="volvo">Volvo</option>
        <option value="saab">Saab</option>
    </optgroup>
    <optgroup label="German Cars">
        <option value="mercedes">Mercedes</option>
        <option value="audi">Audi</option>
    </optgroup>
</select>

The following works:

desktop.<DomListBox> find("//SELECT[@id='1']").select("Mercedes");

This throws an exception:

desktop.<DomListBox> find("//SELECT[@id='2']").select("Mercedes");

com.borland.silktest.jtf.common.InvalidItemIdentifierException: The specified item 'Mercedes' could not be found.

Since the only difference between the two selects is the use of option groups, I guess this is the cause of the problem. Are they not supported or am I using it wrong?

My ugly workaround is to click on the select and select an entry by typing its value with typeKeys. What is the recommended way to select from an option group?


Viewing all articles
Browse latest Browse all 625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>