Comparison with prior art
dandv opened this issue · comments
I'm looking for a library to generate unique CSS selectors for DOM elements in an arbitrary page (see 1, 2, 3, 4).
In case you looked at existing alternatives before coding a new one from scratch, how does this library compare with @martinsbalodis's css-selector, which started development before this one and even has almost the same name, which suggests you might have searched for it.
This is an interesting question. I'll try to do a benchmark to compare various similar libraries.
Here's the list from your other issue (#3):
- @martinsbalodis's css-selector
- @tildeio's https://github.com/tildeio/selector-generator
- @jhartikainen's https://github.com/jhartikainen/dompath (has tests)
- @olivierrr's https://www.npmjs.com/package/selector-query (simple)
- @rishihahs's https://www.npmjs.com/package/domtalk (simple)
- @thomaspeklak's https://www.npmjs.com/package/get-query-selector (very simple)
- @stevoland's https://github.com/stevoland/CSSelector.js (quite simple)
- @ngs's https://www.npmjs.com/package/jquery-selectorator (jQuery)
- @bimech's https://github.com/bimech/ellocate.js (jQuery)
- @desmondw's snowflake for Chrome
Thanks for the detailed comparison with @olivierrr's library.
Forgot to mention - Chromium's also has a cssPath library.
BTW, thanks again for your work on this. I've posted an answer on this SO question, trying to create awareness that generating unique and relatively robust selectors is a non-trivial problem. The repo had 11 stars at the time.