How to create xpath to select book?

113 views Asked by At

Here I am struggling to finding xpath to select the text Book from below Images for Web content and DOM

enter image description here

enter image description here

Advice me how to select book text.

I have done up to this point. May be its strait forward

Xpath I created is :

//*[@class='four columns m-r-3']//following-sibling::h2/strong

image of web content

1

There are 1 answers

5
Rao On BEST ANSWER

Try

//h2[@class='font-plus-2 m-b-half']/strong/text()

UPDATE: Looks there is space in the value for element strong, so you may normalize it as shown below:

//h2[@class='font-plus-2 m-b-half']/strong[normalize-space(.) = 'Book']