css-to-xpath

Converts CSS selectors to xpaths

css-to-xpath

Converts CSS3 selectors to their XPath equivalents.

var cssToXPath = require('css-to-xpath');
 
cssToXPath('p:not(:has(a.x))');

...returns the string:

.//p[not(.//a[contains(concat(' ', normalize-space(./@class), ' '), ' x ')])]

css-to-xpath parses css selectors using bo-selector and turns them into xpaths using xpath-builder

npm install css-to-xpath

BSD