Unable to select from drop down list box


I’m trying to fetch this drops down values (Applications names and randomly select application but Robot framework not identifying this as a List box. I tried Get List Items and all list item keywords but no avail. Its click on the drop down when i use Click Element method. Can some one please advise ?Below is the code snippet. It’s a List box drop down box i think as I can select multiple application from the list

Select Application
<div data-v26b3376a class="aux-dropdown-title aux-input search-dropdown-box" style="width: 150px;" xpath="1"

Plz see the code snippet in attachment.

Hi Russel,

Get List Items and related keywords are not for ordered/unordered lists (<ul><li></li></ul> or <ol><li></li></ol>), but rather for option lists (<select><option></option></select>) which is why it’s not working as you expected.

To get the values you’re after you can use Get Element Attribute


Hi Thank you much for the reply. I tried with Div and UL xpath with Get Element attribute with value and text parameter but it’s returning nothing. When I’m using h6data-v26b337a class Select applications as xpath then it just return text as ‘Select Applications’ but not the list items value. Which xpath i should use to get all the items name from this drop down

I made it working by using
Get Element Attribute (//div[@class=‘aux-dropddown-body’])[2] but it’s still get the partial Items list not all items . I used keyword Scroll Element into view to the last item but it’s still fetch the same items only. I spent 8 hours literally on this thing. It’s nonsense. So I will just stick with this whatever items I fetch then make my script select few other items from the list using Scroll Into view keyword and that’s it.
Thanks once again for your hints!

1 Like

Hi Russel,

Looking at the HTML snippet you provided and your xpath, perhaps I see your issue?

It looks like the values you want are in the value attribute of the <li> tags, however you are selecting a <div> (//div[@class=‘aux-dropddown-body’])[2] and even if you were to select the <li>'s within that <div>, there appears to be only 1 (All Applications). the others are at the same leveel in the dom as the <div> you are selecting.

It’s a pity there’s no id attributes on any of these tags, that makes things much harder for you, Also data-c-26b3376a being an attribute name and not an attribute value is also making it difficult for you.

So I would suggest working with the div that has the aux-dropddown-title class rather than the div with the class aux-dropddown-body (the parent of the one you were selecting) as that one appears to contain all the <li> tags you want

Based on your HTML snippet I’ll suggest you try something like this:

# First get all the <li>'s under the div that has a aux-dropddown-title class
${lilist}=    Get WebElements    (//div[contains(@class, ‘aux-dropddown-title’)])[2]//li
FOR    ${liitem}    IN    ${lilist}
    # ${livalue}=    Get Value    ${liitem}  # not sure if this will work as it's usually used for input elements
    ${livalue}=    Get Element Attribute    ${liitem}    value
    Log    ${livalue}
    # do something with ${livalue}

Another approach if you just want one of the values selected randomly you could do this:

${licount}=    Get Element Count    (//div[contains(@class, ‘aux-dropddown-title’)])[2]//li
${linum}=    Evaluate    random.randint(0, ${licount}) + 1
${livalue}=    Get Element Attribute    (//div[contains(@class, ‘aux-dropddown-title’)])[2]//li[${linum}]    value
Log    ${livalue}

Hopefully that helps,


What @damies13 said … But i want to add following:

but Robot framework not identifying this as a List box.

The issue here is that the HTML code you shared is not semantic dropdown but a bunch of html that is made to look and act like one. Approach shown here in your html would also confuse screen readers (accessibility) and if thats in the scope of your testing, i’d start by asking the devs for support…

Very similar scenario is SeleniumLibrary’s Click Button keyword. It actually looks for button html tag and fails if the actual button is just div that’s made to look like a button …

1 Like

Hi Dave,
I tried with your first approach but my ${llist} Get WebElements returning no value . So I’m just now using ${ilist} = Get Element Attribute (//div[@class=‘aux-doropdown-body’])[2] textContent
This code returning 6/7 items from the list not all then I’m selecting all items one by one then doing
Reloading page then use Scroll Element in to view keyword then using
Element text should be keyword then passing the item name to validate.

Thank you for the reply. No there’s no hard n fast rule from client side on how to validate. so I’m using the above method for now and validating this drop down list