首页 > 解决方案 > 没有 HTML 标记的文本需要 XPath

问题描述

我有以下 HTML 标记:

<div>
<strong>Property type:</strong>  Apartments<br>
<strong>Typology:</strong>  T2<br>
<strong>Living area</strong>  61 m² <br>
<strong>Total area</strong>  61 m²<br>
<strong>Construction year:</strong>  2007                           </div>

我想定位,2007尽管我在语法上有所欠缺。我可以Construction year:使用以下 XPath 作为目标,但不能完全弄清楚其余部分:

//strong[ contains( text(), "Construction year:" ) ]

有任何想法吗?

标签: htmlxpath

解决方案


//strong[ contains( text(), "Construction year:" ) ]/following-sibling::text()[1]


推荐阅读