I’m developing an extension that allows the user to select an element and then highlight it whenever he visits the website, is there a way to programmatically get the xpath of an element?
I tried using classes, ids and tagnames but its not a reliable way to identify an element because its not guaranteed to exist.
>Solution :
There is a existent extension that can do the job for you https://www.npmjs.com/package/xpath-retriever but if you want to develop your own solution you can refer to this question https://stackoverflow.com/a/5178132/18317391