Issue
In my tester I am searching for the different xpaths of some elements that are using the same id, class and other attributes. They are exaclty the same except for their order. I am trying to find out each ones xpath, but all that I find is three elements when I search for this xpath: //input[@id='group[2][325]']
. When I tried to find the first element of the three found elements like this //input[@id='group[2][325]'][1]
I also just get the same three elements. So isn't there anyway to get a specific element from the three found elements?
Solution
In case there are multiple elements matching
//input[@id='group[2][325]']
XPath you can use
(//input[@id='group[2][325]'])[1]
to get the first element.
In the similar way, the n-th element gan be get with
(//input[@id='group[2][325]'])[n]
XPath locator.
Answered By - Prophet
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.