Expression
//div[. = 'hello']
Find all div elements whose string value is "hello". The string value of an element is defined as the concatenation of all these text nodes of the descendants of the element, so all of the following elements will correspond:
<div>hello</div>
<div>hel<i>lo</i></div>
<div>h<i>el</i>lo</div>
text()different is the location path step that retrieves the set of all text node children of the current node context. So
//div[text() = 'hello']
div, node , "" (, = node ) - , , ,
<div>foo bar baz<br/>hello</div>
node - "" .
, , , ,
<div>
hello
</div>
//div[contains(., 'hello')] , //div[contains(text(), 'hello')] ! div node ( , - "" ), XPath 2.0 , , . XPath 1.0 node , , node , , , .
text() , , - ., text(), .