Green
Green

Reputation: 59

How to find child node text in xpath

I am trying to get text from child node from the element tree but when i try to get specific element it is getting empty array.

Here is my command in Chrome Console : $x('//*[@id="mainform"]/child::text()[10]')

then I need to get textContent value which is Memorable word and I dont know how to get it.

Any suggestion appreciated.

enter image description here

Upvotes: 0

Views: 96

Answers (1)

eLRuLL
eLRuLL

Reputation: 18799

you are getting a list of elements, you just need to visit the one you need:

$x('//*[@id="mainform"]/child::text()[10]')[0]

Upvotes: 1

Related Questions