使用 Chrome 开发者工具校验 XPath

使用 XPath 提取页面内容时,如何快速校验规则有效性呢?

此前曾尝试找寻相关的插件,但是使用的体验很糟糕,于是便使用 PHP 调试校验。

最近发现原来 Chrome 开发者工具自带 XPath 校验功能。

  • 方案一:元素面板的查询功能支持 XPath 规则
  • 方案二:控制台中使用内置函数 $x(xpath[, startNode])

来源:Stack Overflow

分享到: 更多

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>