<div> <span></span> Elangovan </div>
我想根据其包含的文本为div编写一个XPath.我试过了
//div[contains(text(),'Elangovan')]
但这不起作用.
string()
//div[contains(string(),"Elangovan")]
或者,您可以检查span的以下文本兄弟包含文本:
//div[contains(span/following-sibling::text(),"Elangovan")]
另见:
> Difference between text() and string()