Trying to get the xpath of an dynamically loaded element. The element represents a dot in a chart. It holds an attribute value I would like to extract. I use the Inspector tool in Chrome to get the xpath of the element. I can copy the xpath but when I try to paste in the copied xpath in the chrome inspector tool no element is found. I can find other elemens on the page using this method.
Why could this be? I can't find any iframe in the html nor any hidden element. My purpose is to find the xpath for this element to use it with Selenium.
Dev tool aren't meant for tags like svg, g, path, circle, canvas
. So you can not generate them automatically.
You can write xpath
by your own for the mentioned tags
, something like this :-
//*[name()='svg']
to locate an svg
tag
let's say you want to write xpath
for the highlighted item (screenshot), you could do something like this :-
//*[name()='g' and contains(@class, 'recharts-layer recharts-line-dot')]//*