I am Unable to click on edit link, it says unable to find the element located by xpath
katalon recorded xpath, spy recorder x path is not working, so i created customized x path
//tbody/tr[3]/td[18]/a[1] - this xpath worked 2 to 3 times and then it stopped working, so i modified xpath and tried again by using below xpaths but it did not work,
Error occurs on step 90, but now i deleted a href attribute from object properties and it started working, now it gives error on step 92, saying same thing unable to find the element located by xpath PFA screenshots of object properties of step 90 and 92 and also test code
First, you need to verify that Xpath is working correctly. There are tools in the browser to help you do that but I can’t advise – I never use Xpath. (Shout out @Brandon_Hein, @Marek_Melocik).
Side note: are you waiting until the element is visible? It could be that the test is too fast for the browser.
Looking at the XPath, I have a very high concern about its correctness. You can verify the correctness of an XPath in Chrome is tool open the inspection tool, navigate to Elements tab, ctrl + F and paste the XPath in. If your target element is highlighted then the problem elsewhere, otherwise you’d need to choose a more robust XPath.
From personal experience though, XPaths with long attribute values are very fragile, so I’d advise choosing a different XPath anyway.
It worked finally by absolute xpath
It accepted the whole x path right from html tag, previously i was giving it from middle starting from td which it was not accepting
xpath that worked is : /html[1]/body[1]/form[1]/section[1]/div[1]/div[1]/table[1]/tbody[1]/tr[1]/td[1]/table[1]/tbody[1]/tr[1]/td[1]/table[1]/tbody[1]/tr[2]/td[1]/div[4]/table[1]/tbody[1]/tr[1]/td[1]/table[1]/tbody[1]/tr[4]/td[2]/div[1]/table[1]/tbody[1]/tr[1]/td[1]/a[1]
Relative path did not work
Relative path worked but only for that session as i tried new session it failed
Problem with relative path is all attributes are dynamic even parent sibling, following child all seemed dynamic…there is no any reference point so i used absolute path
chropath suggested this absolute path…the short one which i was trying to use it did not accept
@Amruta.bagle Can you share the relative xpath for this object? There should be a way to use relative xpath using conditions in object selector properties. As said in above post absolute path would not work in the long run and may also break if you try to run your test on a mobile device.