Package Exports
- css-to-xpath
- css-to-xpath/js/renderer
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (css-to-xpath) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
css-to-xpath
Converts CSS3 selectors to their XPath equivalents.
Usage
var cssToXPath = require('css-to-xpath');
cssToXPath('p:not(:has(a.x))');
...returns the string:
.//p[not(.//a[contains(concat(' ', normalize-space(./@class), ' '), ' x ')])]
Or if you want to continue building the XPath with xpath-builder:
var cssToXPath = require('css-to-xpath');
var xpathBuilderObject = cssToXPath.parse('p:not(:has(a.x))');
xpathBuilderObject = xpathBuilderObject.where(cssToXPath.xPathBuilder.text().equals('Some Text Content'));
// And get the XPath string
xpathBuilderObject.toXPath();
How?
css-to-xpath parses css selectors using bo-selector and turns them into xpaths using xpath-builder
Install
npm install css-to-xpath
License
BSD