I need to create scripting to click the button next to one object. Due to the customer requested not to use Repo, I tried DP but the objects didn't have unique properties so I used the xpath.
the structure is like below:
<td> Row 1</td>
<td>
<input class=button></input>
</td>
The issue is I cannot use "following sibling" in UFT (I tested it in the browser and works but failed in UFT)
xpath 1: //td[title()='Row 1']/following-sibling::td//input[@class='button'] -> FAILED
xpath 2: (//td[title()='Row 1']/..//td//input[@class='button'])[1]-> SUCCESS
the xpath 2 is the workaround but tbh should be avoided because of the index. Could anyone suggest the cause UFT cannot use the sibling and give a good alternative for the xpath?
This case also applies to other siblings like "preceding-sibling" and "ancestor".