Socket
Socket
Sign inDemoInstall

css-to-xpath

Package Overview
Dependencies
2
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    css-to-xpath

Converts CSS selectors to xpaths


Version published
Weekly downloads
129K
decreased by-5.08%
Maintainers
1
Install size
141 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 22 Oct 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc