<html>
<tr id="userman-orgchart-tree-node-9" class="fancytree-expanded fancytree-folder fancytree-has-children fancytree-exp-e fancytree-ico-ef">
<td>
<span class="fancytree-node" style="padding-left: 16px;">
<span class="fancytree-expander"></span>
<span class="fancytree-icon"></span>
<span class="fancytree-title">Legal</span>
</span>
</tr>
<tr id="userman-orgchart-tree-node-10" class="fancytree-active fancytree-folder fancytree-has-children fancytree-exp-c fancytree-ico-cf">
<td>
<span class="fancytree-node" style="padding-left: 16px;">
<span class="fancytree-expander"></span>
<span class="fancytree-icon"></span>
<span class="fancytree-title">Branch Performance Test</span>
</span>
</tr>
</html>
在这种情况下,在上述情况下,我如何编写元素定位器来确定分支性能测试的范围,同时考虑到 tr id 可以动态地保持更改为 11或12 通过在。之间添加另一条记录。
答案 0 :(得分:1)
//span[@class='fancytree-title' and text()='Branch Performance Test']/ancestor::span
以上将返回条件
的跨度的所有跨度祖先OR
//span[@class='fancytree-title' and text()='Branch Performance Test']/parent::span
以上将返回条件
的跨度的第一个跨越父级