XPath Search在span类内部,遵循li内的特定文本

时间:2018-09-08 17:58:17

标签: xpath

我想找到“你好吗?”在html的这一部分中使用xpath:

<li>Hello<span class="redS bold">How are you ?</span></li

我尝试过:

//span[contains(@class, 'redS bold') and text() = 'Hello']

预先感谢您的帮助

1 个答案:

答案 0 :(得分:0)

也许

//span[contains(text(),'How are you')]

?也许

//span[contains(@class,'redS bold') and contains(text(),'How are you')]