pmakkena
10 years agoOccasional Contributor
can some help me with xpath for 2 button .
The 2 sample html are
1) <input id="btnMoveRight" class="arrowBtn" type="button" value=" > " onclick="moveRight('Funds')">
2)<input id="btnMoveRight" class="arrowBtn" type="button" value=" > " onclick="moveRight('Reports')">
The chrome is suggessting same xpath for both of them i.e//*[@id="btnMoveRight"].
can you please help me how to make unique the above 2 htmls options.
Hi Prashant,
IDs of both buttons are the same. Good approach is to assign different names for different objects.
Anyway, I noticed that the moveRight function passes different parameters in different objects. You can try using the following XPath expressions:
//*[@id="btnMoveRight" and contains(@onclick, "Funds")] //*[@id="btnMoveRight" and contains(@onclick, "Reports")]