Xpath is unstable in Get value

Hi,

I’m Dika, I have problem with xpath which is unstable when I run in Control Tower /scheduler. When the first time I run this flow everything works. But in next schedule, Xpath does not work. This is the website https://www.tnt.com/express/en_id/site/shipping-tools/tracking.html, and this is the xpath which is unstable

xpath= /html/body/div[3]/div[1]/pb-root/div/div/div/pb-track-trace/pb-search-results/div[1]/pb-shipment/div/div[1]/sham-shipment-addresses/div/div[2]/div[2]/div[2]/sham-shipment-destination-date/span/span[2]
and

xpath= /html/body/div[3]/div[1]/pb-root/div/div/div/pb-track-trace/pb-search-results/div[1]/pb-shipment/div/div[5]/sham-shipment-history/table/tbody/tr[1]/td[3]

What should I do to solve this problem?
Thank you,

Regards
Dika

Hi @dika193 you are using absolute XPaths, so if the structure of the page changes they will not work.
Try using relative XPaths instead, for example, //sham-shipment-destination-date/span/span[2] and //table/tbody/tr[1]/td[3]/span.
You can read more about them in our XPath guide: https://kb.workfusion.com/display/RPAe/XPath+Guide and also see how to use them in this tutorial.

I hope it helps!

@dika193 did using a relative XPath help you solve the issue?

yes I did, it’s work when using relative xpath.
Thank you

1 Like