1

I'm trying to get an attribute of the small arrow next to 'Date' that is shown in the pic:

Element's Xpath

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?

bad_coder
  • 8,684
  • 19
  • 37
  • 59

2 Answers2

0

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"
undetected Selenium
  • 151,581
  • 34
  • 225
  • 281
Swati001
  • 11
  • 4
0

Remove svg, and change iron-icon[2] to iron-icon[1], which is svg. You don't need them both.

user207421
  • 298,294
  • 41
  • 291
  • 462