Website occasionally has different xpath for the same element - what to do?

I’m trying to get the text of a certain element, and despite it being at the same place “visually”, sometimes it’s:
//*[@id="provider-mounter"]/div/div[2]/div[2]/div/div[1]/div/div[2]/div/div[2]/div/div/div/div/div[2]/div/div[4]/div/div/div/div/div[2]/div/table/tbody[1]/tr/td[6]
and other times it’s
//*[@id="provider-mounter"]/div/div[2]/div[2]/div/div/div/div[2]/div/div[2]/div/div/div/div/div[2]/div/div[3]/div/div/div/div/div[2]/div/table/tbody/tr/td[6]/span

Other than having 2 functions with both xpaths, is there an easy way to determine which one has “values” (not blank) and record that text?

use relative xpath
but if you dont know then you can use both commands and check which one has value with javascript

These you are using are not stable xpaths, use other much more generic and stable xpaths, each web element is recognizable by many different xpaths, some of which are very generic and do not change

The problem I’m encountering with relative xpath (from what I understand) is that the value I want to get is a random number, so there’s no unique identifier other than its position, and sometimes it’s one xpath vs the other.

What do you mean? I’ve tried using both xpaths from inspect elements, but the xpath changes with either xpaths:
Screen Shot 2023-02-15 at 3.40.46 PM

This will give absolute xpath only.

So you’re saying that this is limitation of UI.Vision RPA (the fact that there’s no unique identifier other than its position, and sometimes it’s one xpath and other times it’s a different one)?

UI Vision RPA will use whatever xpath you provide.

If you indicate the url of the page, I can use some tools to find a good xpath.
With the xpath axes you can also recognize dynamic elements next to each other.
It’s important to find a good xpath to build good automations

Thank you!!! What tools are you using?

I tried dm’ing you the url but it looks like I don’t have enough privilege - could I dm you on superuser/stackoverflow? (assuming you have the same username, no worries if you’d rather not!)

Hi, I’m not registered on superuser/stackoverflow.
In the chrome store there are many addons to detect xpath, I have tried about 30 different ones because each one detects different xpaths, some of which are very generic and do not change.