根据 XPath 中的元素后代文本筛选元素



>假设我有一个包含以下行的表,

...
<tr>
<th title="Library of Quintessential Memes">LQM:</th>
</tr>
<tr>
<th title="Library of Boring Books">LBB:</th>
</tr>
...

我想选择所有<tr>第一个<th>子文本以"L"开头的元素。如何使用 XPath 选择器执行此操作?

使用starts-with函数:

//tr[starts-with(th[1],"L")]

最新更新