【发布时间】:2013-10-21 20:07:14
【问题描述】:
我想定位这个元素,
<div class="item-price">$0.99</div>
使用 XPath 表示选择 class 属性等于 "item-price" 并且其内容包含美元符号 ($) 的元素。
【问题讨论】:
-
某个属性与
@attributename匹配,可以对内容使用contains()函数。您能否尽最大努力使用这 2 个? -
好的。
//div[@class="item-price" and contains("$")]但我不确定如何进行连词。我也见过//div[one][theother]。 -
你看过documentation of
contains()吗?你非常接近(contains(.,'$')会这样做)