Xpath syntax to find an element

Hello! I request your help to know how to identify an element by xpath using the content of the HTML element instead of the ID of the element


In the image you can see how using the syntax xpath;
I can find the content of the popup window, the which has an ID:19.


The IDs of this website change constantly, so I want to try to identify that same element but using the text it contains, since this is not a variable.

Is it possible?

@Yoshi You can identify an element using the text it contains. find an example syntax below
//div[contains(text(), ‘example text’)]

just use tag name and mention the text it contains using above syntax

1 Like


did you try to copy and use Full Xpath of the button?

1 Like

Yes, I’ve tried using Full Xpath but since ID is changing constantly, is not a option

Can you copy and paste the full XPath you tried to use? Usually the full XPath looks like this:


Sometimes the numbers change when the element is dynamic, but an asterisc [*] instead of the number might be helpful.


1 Like