0

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;">
6
  • Is your listbox is associated with <option> or <li>??? Check below video may help. youtube.com/watch?v=DfYj3DYnN0c Commented Mar 9, 2015 at 7:06
  • Yes associated with <option> Commented Mar 9, 2015 at 7:19
  • Then watch the video, it will help. Commented Mar 9, 2015 at 7:20
  • <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> ..... Commented Mar 10, 2015 at 2:31
  • The code is shown in above Commented Mar 10, 2015 at 2:31

1 Answer 1

0

Try this:

@browser.select_list(name:"cboEmploymentTypeId").option[1...n].select
Sign up to request clarification or add additional context in comments.

1 Comment

Welcome to StackOverflow, and thanks for your answer! Could you please edit it to add a little more information to your answer - because this is a very old question, anyone finding it from a search engine may appreciate a little more context.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.