Issue
I am trying to get a element in a list by specifying index
For example I have this xpath:
"//p-dropdown[@formcontrolname='PrimaryRoleId']//ul[contains(@class, 'ui-dropdown-items')]//li[contains(@class, 'ui-dropdown-item')]" and it gives me this:
But when I add [1] at the end of xpath I still get the same thing? How can I get the first (or specific matching element by index)?
Solution
Can you try to enclose it with parenthesis "()"
(//p-dropdown[@formcontrolname='PrimaryRoleId']//ul[contains(@class, 'ui-dropdown-items')]//li[contains(@class, 'ui-dropdown-item')])[0]
Answered By - Ashok Kakade
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.