Reputation: 10570
I have this html element
<li>
<em>Features</em><br>
Full Options, Fully Auto, Fully Loaded, Power Locks, Power Steering, Airbag: Driver, Airbag: Passenger, Airbag: Side, Alarm, Power Windows, Rear Window Wiper, Anti-Lock Brakes, Power Seats, CD Changer, CD Player, A/C: Front, A/C: Rear, Navigation System,
</li>
I want to take the text inside the li
.
Please note that I can reach the li but i don't know how to get the text inside it
I tried this:
.//ul/li[3]/text()
and this
.//ul/li[3]/br/text()
and this:
.//ul/li[3]/br[1]text()
but i got empty result.
Upvotes: 0
Views: 124
Reputation: 10570
I found the solution myself.
It is
string(.//ul/li[3])
I also found a better solution which is
.//ul/li[3]/text()[last()]
Upvotes: 1
Reputation: 176896
try this to get text from li
.//ul/li[3][text()]
for tha you have to dolike this
.//ul/li[3][text()[0]] -- select first text node
.//ul/li[3][text()[1]] -- select second text node
Upvotes: 2