Recently, I'm doing web scraping using the awesome library HtmlAgilityPack. With HtmlAgilityPack, I use XPath to match the required object/tag in the DOM. While working with XPath, I'm wondering is there anyway to test XPath in Google Chrome browser with highlighting the matched tag in browser. The answer is YES. We can test XPath in Google Chrome.
Here is the steps to do so:
- Open Developer Tools
- Select Console tab.
- Use
$x
token. For example,$x("/html/body")
will select thebody
tag.
A picture worth a thousand words. :)
没有评论:
发表评论