I am trying to get the path in the html dom for a specific object.
Using javascript or jquery.(When I select/hover over the object.)
I do not know the structure in advance.
For example:
<html>
<body>
<div>
<div>
Not selected
</div>
<div>
Selected Text
</div>
</div>
</body>
</html>
The "Selected Text" Div path should be something like:
//HTML/BODY/DIV[0]/DIV[1]
Any help will be appreciated.
I have looked at this answer but it does not give an indication regarding the index of the element (In my example the value in the square brackets - 1 in DIV[1]
).
By the way is there a "technical" name for this path?
I have seen the term XPath but am not sure that this is it.
Be happy and enjoy life.