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
  • 11,289
  • 20
  • 44
  • 72

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
  • 183,867
  • 41
  • 278
  • 352
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
  • 305,947
  • 44
  • 307
  • 483