The
getSelector
method fromaxe-core
2.x as a standalone package.
The CSS selectors generated by this package are designed to be accurate, unique, and easy for humans to read/comprehend.
With npm
, do:
$ npm install --save axe-selector
import getSelector from 'axe-selector'
const el = getDOMElementSomehow()
// Generate a selector.
const selector = getSelector(el)
MPL-2.0