如何仅选择父跨度 web 元素而不选择子元素?
列出 summaryLinks = summary.findElements(By.xpath(""));
我的 HTML 代码:
<li>
<div class="mod-indent mod-indent-2">
<a href="http://mysite.com">
<img class="activityicon" alt="URL" src="http://mysite.com">
<span class="instancename">LinkText <span class="accesshide "> URL</span></span>
</a>
</div>
</li>
我尝试了以下 xpath 但没有
用。//div[@class='mod-indent mod-indent-2']/a/span[@class='instancename']
.//div[@class='mod-indent mod-indent-2']/a/span[1]
.//div[@class='mod-indent mod-indent-2']/a/span/.
.//div[@class='mod-indent mod-indent-2']/a/span [position() =1]
.//div[@class='mod-indent mod-indent-2']/a/span/span [position() =1]