XPath选择一个包含指定文本的单元格的表格行 [英] XPath to select a table row that has a cell containing specified text

查看:698
本文介绍了XPath选择一个包含指定文本的单元格的表格行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何选择一个包含XPath指定文本的单元格的表格行?

使用:

$ p $ ExpressionSelectingTable / tr [td // text()[contains(。,'targetString')]]

这意味着

选择 ExpressionSelectingTable 选择的任何表格的子元素( tr ) c $ c> tr )至少有一个 td 子元素,它至少有一个包含字符串'targetString'


How do I select a table row that has a cell containing specified text with XPath?

解决方案

Use:

ExpressionSelectingTable/tr[td//text()[contains(., 'targetString')]]

This means:

Select every tr that is a child of any table selected by the expression ExpressionSelectingTable and that (the tr) has at least one td child that has at least one text-node descendent that contains the string 'targetString'

这篇关于XPath选择一个包含指定文本的单元格的表格行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆