Select a node with XPath whose child node contains a specific inner text

后端 未结 4 1720
小鲜肉
小鲜肉 2021-02-14 03:14

Given the following XML:


    
  • abcText1cba
  • abcText2cba
  • 4条回答
    •  一向
      一向 (楼主)
      2021-02-14 03:38

      //li[./span[contains(text(),'Text1')]] - have just one target result
      //li[./span[contains(text(),'Text')]] - returns two results as target
      

      This approach is using something that isn't well documented anywhere and just few understands how it's powerful

      Element specified by Xpath has a child node defined by another xpath

    提交回复
    热议问题