While working with HtmlAgilityPack to build a web scrapper/crawler, I noticed something: I hate XPath. It’s big, clunky, and verbose. After a bit of searching, I found a neat online app: http://css2xpath.appspot.com/. As the name suggests, it converts CSS selectors to XPath selectors. The only problem is that I wanted a client-side solution.
Housed in a single static class, the handful of functions contained within are easy to use. For example:
Is all that it takes. That expression will yield:
Other features include the ability for you to define your own transformation rules. See the link below for more information and how to download. Enjoy!
Download/read about it at BitBucket: https://bitbucket.org/MostThingsWeb/css2xpath