0
votes

I can't be able to select values from the dropdown in selenium webdriver. I tried all the ways using name and xpath selectors. Please help.

The code is:

<span id="cboEmploymentTypeId" class="select" tabindex="0" name="cboEmploymentTypeId" unselectable="on" style="-moz-user-select: none; box-shadow: none;">
1
Is your listbox is associated with <option> or <li>??? Check below video may help. youtube.com/watch?v=DfYj3DYnN0c - Uday
Yes associated with <option> - user123
Then watch the video, it will help. - Uday
<label for="cboEmploymentTypeId"> <select id="cboEmploymentTypeId" onchange="Custom.showAdditionalFields(this);" name="cboEmploymentTypeId" style="display: none;"> <option class="" value="">-- Välj jobbtyp --</option> <option class="opt1" value="1">Fast anställd</option> <option class="opt2" value="2">Egen företagare</option> ... </select> <span id="cboEmploymentTypeId" class="select" tabindex="0" <span data-value="">-- Välj jobbtyp --</span> <span data-value="1">Fast anställd</span> <span data-value="2">Egen företagare</span> ..... - user123
The code is shown in above - user123

1 Answers

0
votes

Try this:

@browser.select_list(name:"cboEmploymentTypeId").option[1...n].select