如何使用XPath For Robot Framework Selenium Python从下拉列表中选择列表项目

发布于 2025-01-17 20:07:56 字数 1080 浏览 2 评论 0原文

我想从下拉列表中选择带有机器人框架的 Textes3

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>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

赠佳期 2025-01-24 20:07:57

您将无法选择任何下拉项作为parent &lt; div&gt; 包含 样式 >属性值为 display:none;

您需要查看其他一些元素来执行此特定操作。

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.

遥远的她 2025-01-24 20:07:56

如果您想从上面选择文本“ textes3”,则可以使用下面的XPath,

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

如果这没有回答您的问题,请进行更多解释。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文