
[英]xpath to find a text box, below a specific node which in turn contains specific sub node
[英]With Xpath, find the leafiest table node that contains an input box with id=“userid”
我尝试了几种不同的变体,但似乎无法正确实现。 给定html像:
<html>
<body>
<table>
<tr>
<td>
<table> <-- I want this table
<tr>
<td><input type="text" id="foo"/></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
我想找到内部表。
我已经尝试过// // table / * / input [@ id ='foo'],但是我没有得到正确的东西-有人对我没有快速解决方案吗? :-)
非常感谢!
其他方法:
//table[not(.//table)][.//input[@id='foo']]
未经测试:
//input[@id='foo']/ancestor::table[1]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.