css-to-xpath
Converts CSS selectors to xpaths
Last updated 5 years ago by joshski .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install css-to-xpath 
SYNC missed versions from official npm registry.

css-to-xpath

Converts CSS3 selectors to their XPath equivalents.

Build Status

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

Current Tags

  • 0.1.0                                ...           latest (5 years ago)

4 Versions

  • 0.1.0                                ...           5 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 9
This Month 105
Last Day 2
Last Week 138
Last Month 170
Dependencies (2)
Dev Dependencies (5)

Copyright 2014 - 2016 © taobao.org |