XPath to select following-sibling

前端 未结 2 1054
北恋
北恋 2020-12-30 10:19

This is the code that I currently have:

  • <
2条回答
  •  臣服心动
    2020-12-30 11:06

    Adding to the answer above, both the expressions below will work well.

    //span[contains(text(), 'ABZ')]/following::section/span[@name='edit']
    

    OR

    //span[contains(text(), 'ABZ')]/../following-sibling::section/span[@name='edit']
    

    Notably, the axis following will pick each node following the context node while the axis following-sibling will only pick the sibling nodes to the context node.

提交回复
热议问题