QA_75
QA_75

Reputation: 3

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>

Upvotes: 0

Views: 2562

Answers (2)

undetected Selenium
undetected Selenium

Reputation: 193208

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.

Upvotes: 0

Akzy
Akzy

Reputation: 1926

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.

Upvotes: 1

Related Questions