Xpath: select div that contains class AND whose specific child element contains text

后端 未结 4 1837
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 04:02

With the help of this SO question I have an almost working xpath:

//div[contains(@class, \'measure-tab\') and contains(., \'someText\')]

Ho

4条回答
  •  孤街浪徒
    2020-12-13 04:23

    You could use the xpath :

    //div[@class="measure-tab" and .//span[contains(., "someText")]]

    Input :

    
    
    someText
    someText2

    Output :

        Element='
    someText2
    '

提交回复
热议问题