Search code examples
seleniumxpathselenium-webdriverfirepath

How to create xpath to select book?


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


Solution

  • 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']