TestProject Forum

How to handle parameterized xpath with single quote

Have a parameterized xpath “.//h3[contains(.,’{bookname}’)]”. The element identification works fine normally but fails when there is a single quote in the parameter {bookname} like Devil’s Sea.

Can someone advice any solution.

1 Like

Hi @sanshec ,
First of all, welcome to our community :slight_smile:

  • Can you please elaborate on your intention?
  • It would be helpful if you could share a screenshot

Hi Alex,

Thanks for the response. Was able to handle single quotes using double quotes the traditional way.
The bookname is a parameter and carried different values like The Odyssey, The Devil’s Sea, The $ Dream…

Instead of “.//h3[contains(.,{bookname})]” , I used “.//h3[contains(.,"{bookname}")]” and it worked.

Thanks
Santhosh

1 Like

Hi @sanshec ,

Great, I am happy to hear that your issue is resolved.
If you have any more questions please feel free to ask :slight_smile: