'Finding Element's xpath address
I'm trying to get an attribute of the small arrow next to 'Date' that is shown in the pic:
I used Katalon recorder to find the element's xpath address, and it gave me the following xpath:
"//div[5]/sort-direction/iron-icon[2]"
But this xpath is not enough, because I need the "d" attribute which is inside the 'path' tag (as you can see in the pic).
I tried to modify the xpath like this :
"//div[5]/sort-direction/iron-icon[2]/svg/g/path"
But then I got an NoSuchElementException exception.
Any ideas of how to get this attribute?
Solution 1:[1]
Remove svg, and change iron-icon[2] to iron-icon[1], which is svg. You don't need them both.
Solution 2:[2]
Please check the count of iron-icon. From picture given, it seems the "d" attribute you are trying to fetch is under the hierarchy of iron-icon at index 1 not 2.
Please try the xpath as :
"//div[5]/sort-direction/iron-icon[1]/svg/g/path"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user207421 |
| Solution 2 | undetected Selenium |

