Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert CSS Selector to XPATH

I saw an article online on how to map CSS selectors to XPATH queries, so I'm trying to figure out if there are any .NET libraries out there that can do the mapping/conversion. Please let me know if you have any references or any ideas on how to perform the mapping (if a library is not available).

like image 669
Kiril Avatar asked Sep 24 '12 20:09

Kiril


1 Answers

You could try the Css2Xpath library found here: https://bitbucket.org/MostThingsWeb/css2xpath/wiki/Home

I have never used it but maybe you can share your experience with us.

Here is a small sample of usage:

String css = "div#test .note span:first-child";
String xpath = css2xpath.Transform(css);
like image 152
MUG4N Avatar answered Oct 25 '22 22:10

MUG4N