无法在子 div xpath 上找到元素

问题描述 投票:0回答:1
<div class="gwt-Label WLFP WEEP" data-automation-id="promptOption" id="promptOption-gwt-uid-2" data-automation-label="Start" title="Start" aria-label="Start" role="link" tabindex="0">Start</div>

在我们的应用程序中,搜索后我们得到一堆搜索结果,这些结果基本上都是可点击的链接,我试图找到搜索文本,例如上面示例中的“开始”,然后单击它。 我的 xpath

//div[@data-automation-id='promptOption']/
突出显示该区域,但之后当我提供所需的文本路径时,它找不到该区域。

//div[@data-automation-id='promptOption']//span[contains(@text, 'Start')]
//div[@data-automation-id='promptOption' and text()='Start']
//div[@data-automation-id="promptOption"]//a[.='Start']
selenium-webdriver xpath
1个回答
0
投票

您需要:

//div[@data-automation-label="Start"]
© www.soinside.com 2019 - 2024. All rights reserved.