How can i get the shortest selector for any clicked element?
I want use this selector later to recover the same (or a nearly same) result.
Is there any existing method?
My ideas for that are searching with priority for:
- single-used ID
- multi-used ID with counter
- single-used name
- multi-used name with counter
- single-used classname
- multi-used classname with counter
- shortest parent path to 1.-6.
Not shure how to build a short path for maximum reliability and maximum flexibility (f.e. new parent-tags or a movement in the code).
I would suggest something like:
When an element is clicked
#<id>
#<generated-id>
i.e. something like: