if I have some html like the following
Game Title
The conditions in square brackets ("predicate") specify conditions for the node. The div
node is not h1
at the same time, so the negation is satisfied. But if you used child
instead of self
, which was probably your original intent, you would not get the expected text - you would get nothing, because it means "Search for a div with unique_id tah does not have a h1/span child".
If you want text, specify text():
//div/text()[last()]
div[@class = 'unique_id']/text()[not(normalize-space() = '')]
or
div[@class = 'unique_id']/text()[last()]
depending on context.
Note that you still have to trim the resulting text node.