I have this html code
<div>
<span>test</span>
foo
<br />
bar
</div>
And I'm trying to find it with the text directly inside the div (so foo bar).
Normally, I would go //div[normalize-space(text()) = 'foobar'], but because of the
it is not working. I tried to add spaces or special chars, or trim them, but nothing seem to work.
From tests I saw that
//div/text() = foo bar
//div/text()[1] = foo
//div/text()[2] = bar
//div[text()[1] = foo] = the div
//div[text()[2] = bar] = nothing
It seem that text() return only a index[2] when returning a value and not for searching a value.
I tested this code with java / selenium and firepath (a plugin of firebug to test xpath).
Anybody have an idea on how to get the div from the text, and if possible, without using contains because they are not accurate.
Thank you.