Suggest a library to get selector(s) of given element
<p>There are a lot of libraries that return elements by css/xpath selectors, but how can I get such selector by element? Maybe you know some library that does it? I know it is implemented in Selenium IDE, but the codebase is rather huge and I was unable to find where do they do it (and I think that I can not just use part of the selenium).</p>

<p>Sample use case - user selects element on html page, and we must get some sensible selector for it (that would preferably still return the same element when html changes).</p>

<p>For sure it's possible to write such a library, but if one already exists...</p>
