html - 没有 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:" ) ]
有任何想法吗?
解决方案
//strong[ contains( text(), "Construction year:" ) ]/following-sibling::text()[1]
推荐阅读
- scala - 使用 spark-submit 将 HashMap 参数传递给 Scala
- android - java.lang.IllegalArgumentException: 南纬超过北纬 (23.029011581089936 > 23.0060917)
- node.js - 自动迁移创建数据库名称“未定义”,在 loopback-connector-cassandra 中的“未定义”数据库中创建表
- javascript - 卸载或卸载扩展程序时,Chrome Native Messaging 退出 NodeJS 主机
- sql - 在员工领取高薪的部门工作的员工姓名
- flutter - 颤振:处理 File.path 空/空
- gemfire - Gemfire 9.8.4 的主机要求
- c# - .net如何在zipfile中包含目录和文件关系
- ngxs - ngxs 实验室 immer 要求完整状态?
- sql - 如何查找 SQL 数据库信息