Shadow DOM Unique Selector Generate using JavaScript

Viewed 9

There is a website that has a shadow dom element, the tag name is my-element.

Now I want to generate its selector using javascript on the click event attached to the document Object.

I can generate its selector by first generating the dom root to that element inside the shadow dom. But if there are multiple shadow roots with the same tag name. I am not able to generate a unique selector.

0 Answers
Related