Home > front end >  How to select a list item from the dropdown list using Xpath for Robot framework Selenium Python
How to select a list item from the dropdown list using Xpath for Robot framework Selenium Python

Time:03-31

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

HTML:

<div  style="width: 389px; left: 342px; top: 969px; display: none;">
<div id="eryerye12ry56756rt" tabindex="-1"  style="overflow: auto; transform: translateZ(0px);">
<ul role="listbox" tabindex="0" >
<li role="option"  unselectable="on" brnalid="ethduyuyuyujfyeroT" style="user-select: none;"> Texte1 </li>
<li role="option"  unselectable="on" brnalid="ksdhfiyzegyufizyefge" style="user-select: none;"> Texte2 </li>
<li role="option"  unselectable="on" brnalid="zrzeonvisyjrddudgfi56" style="user-select: none;"> Texte3 </li>
</ul>
</div>
</div>

CodePudding user response:

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.

CodePudding user response:

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.

  • Related