提问人:Zahid Ulla 提问时间:9/29/2023 最后编辑:Zahid Ulla 更新时间:10/7/2023 访问量:17
如何找到具有相同类名和文本的元素,如下所示
How to locate the element which has same class name and text as shown below
问:
我需要单击列表中的元素,但我无法单击我正在使用的元素(//[@class=“pb-dropdown__contents pb-dropdown__contents--no-margin pb-dropdown__contents-enter-done”])[0] 和这个也是 //[@class=“pb-dropdown__contents pb-dropdown__contents--no-margin pb-dropdown__contents-enter-done” 和 text()=“Create”] 但似乎没有一个起作用,因为下拉列表的标题和我需要点击的列表都具有相同的名称并且是同班。请帮帮我 您可以在此链接中引用 DOM(https://i.stack.imgur.com/cnbhu.png)
我尝试了所有这些定位器 *[@class=“pb-site-nav-link__title” 和 text()=“创建”]
(//[@class=“pb-dropdown__contents pb-dropdown__contents--no-margin pb-dropdown__contents-enter-done”])[0] 还有这个 //[@class=“pb-dropdown__contents pb-dropdown__contents--no-margin pb-dropdown__contents-enter-done” 和 text()=“Create”]
答:
0赞
Dinesh Kumar
9/29/2023
#1
你能试试这个 loactor 吗?
//span[contains(@class,'title') and text()='Create']/parent::a
评论