Fetch-Selector
Fetches a selector of an html element, and shortens it with a genetic algorithm.
Installation
npm install --save fetch-selector
Usage
// Example elementconst div = document // Return a default selector string from an element// This selector is quite long, but the function is quicker// than the shortened oneconst longSelector = // returns: "#top div:nth-child(4) > div:nth-child(8) > p.n8Z-E > a.zE7yA" const shortSelector = // returns: #top div:nth-child(4) div:nth-child(8) a.zE7yA"