2

I am trying to select an item from a dropdown list in robot framework (using RIDE), but I cannot get the item by variable name.

<div class="chosen-drop">
    <div class="chosen-search">
        <input type="text" autocomplete="off">
    </div>
    <ul class="chosen-results">
        <li class="active-result" data-option-array-index="0">Geen optie gekozen</li>
        <li class="active-result" data-option-array-index="2">ABB</li>
        <li class="active-result" data-option-array-index="3">Algem</li>
        <li class="active-result" data-option-array-index="4">AOV</li>
        <li class="active-result" data-option-array-index="5">AW</li>
        <li class="active-result" data-option-array-index="8">AOZ</li>
    </ul>
</div>

I can use this and get the result:

Click Element    xpath=//*[@id="KEUZE_N_MiddelId_N1010D_chosen"]
Click Element    xpath=//*

[@id="KEUZE_N_MiddelId_N1010D_chosen"]/div/ul/li[4]

But the index number can change, so I want to click the element based on the value, in this example 'ABB'. How can I achieve this?

jvdhooft
  • 657
  • 1
  • 12
  • 33
Alex
  • 23
  • 1
  • 4

2 Answers2

1

You can Try the following:

Select From List By Label| css=ul.chosen-results| ABB

Sakshi Singla
  • 2,462
  • 1
  • 18
  • 34
0

It is very similar to this SO post but not exact enough to be considered a duplicate. Based on your already achieved results I think this should work for you.

[@id="KEUZE_N_MiddelId_N1010D_chosen"]/div/ul/li[text() = 'ABB']

Community
  • 1
  • 1
A. Kootstra
  • 6,827
  • 3
  • 20
  • 43
  • Thanks for your reply. the problem is that the id can change every deploy and we dont have control of it. we have controle over the tekst in active-result – Alex Apr 18 '17 at 15:35