'How to select a list item from the dropdown list using Xpath for Robot framework Selenium Python

I want to select Textes3 with robot framework from the dropdown.

HTML:

<div class="ant-select-dropdown ant-select-dropdown--single ant-select-dropdown-placement-bottomLeft" style="width: 389px; left: 342px; top: 969px; display: none;">
<div id="eryerye12ry56756rt" tabindex="-1" class="ant-select-dropdown-content" style="overflow: auto; transform: translateZ(0px);">
<ul role="listbox" tabindex="0" class="ant-select-dropdown-menu ant-select-dropdown-menu-vertical ant-select-dropdown-menu-root">
<li role="option" class="ant-select-dropdown-menu-item ant-select-dropdown-menu-item-active" unselectable="on" brnalid="ethduyuyuyujfyeroT" style="user-select: none;"> Texte1 </li>
<li role="option" class="ant-select-dropdown-menu-item" unselectable="on" brnalid="ksdhfiyzegyufizyefge" style="user-select: none;"> Texte2 </li>
<li role="option" class="ant-select-dropdown-menu-item" unselectable="on" brnalid="zrzeonvisyjrddudgfi56" style="user-select: none;"> Texte3 </li>
</ul>
</div>
</div>


Solution 1:[1]

if you want to select the text "Textes3" from the above you can use the below xpath

//li[contains(text(),'Textes3')].click();

If this does not answer your question, so please explain it more.

Solution 2:[2]

You won't be able to select any of the dropdown item as the parent <div> contains the style attribute value as display: none;.

You need to look at some other elements to perform this specific operation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Akzy
Solution 2 undetected Selenium