Find web element by text

I am trying to get price from website about rented product for 40 days.

However as the no. of days differ for different product. The only common thing is the text “40 days” will be available for all products.
I tried using xpath - but it changes and I tried find elements by text, and it doesn’t work.
Any advice?

Hi Lin, can you share the URL of the page, from which you need to get the data?

As it is a vendor website, so i am afraid i can’t share it… what other info would be required? Perhaps I can copy it?
Thanks so much.

Yes, please code the html code of this part of the page (the one in your original post). I think it will be possible to build a relative xpath that will work for all products.

These are just separate xpaths. Can you copy the whole code of that block on the page? You can post it here in a .txt file.

Overall, I think you can use contains() and text() to build the xpath for these elements (see guide), but it is hard to say for sure without seeing the code.

Hi Lin, did you manage to solve the issue using contains() operand?
If not, please send over the html code of the page.