zoukankan      html  css  js  c++  java
  • 使用chrome调试xpath

    使用chrome调试xpath

    相信玩过爬虫的都知道一些库,如lxml(python),可以使用xpath方便地对HTML进行提取,但当真正用的时候,问题就来了,想找到一个元素往往要调试好几遍,而且得先code,下面提供了几个工具及如何用chrome进行xpath test

    1.XPath Helper

    https://chrome.google.com/webstore/detail/xpath-helper/hgimnogjllphhhkhlmebbmlgjoejdpjl

    1. Open a new tab and navigate to your favorite webpage.
    2. Hit Ctrl-Shift-X to open the XPath Helper console.
    3. Hold down Shift as you mouse over elements on the page. The query box will continuously update to show the full XPath query for the element below the mouse pointer. The results box to its right will show the evaluated results for the query.
    4. If desired, edit the XPath query directly in the console. The results box will immediately reflect any changes.
    5. Hit Ctrl-Shift-X again to close the console.

    2.Xpath Finder – xpath查找助手

    https://chrome.google.com/webstore/detail/xpath-finder/ijaobnmmgonppmablhldddpfmgpklbfh/related

    在chrome开发者工具里增加一个面板,帮助你快速查找匹配XPATH表达式的元素。
    
    1. 匹配的节点会用红色边框突出显示。
    2. 在结果列表里可以直接inspect对应节点。
    3. 记录XPATH查找历史,方便查看历史。

    3.chrome console

    F12->$x(“//title”)

    [<title>Online Tools for Software Developers (Free)</title>]

  • 相关阅读:
    云计算设计模式(三)——补偿交易模式
    云计算设计模式(二)——断路器模式
    Java Web开发之详解JSP
    Java Web开发之Servlet、JSP基础
    Android数据库开发——SQLite
    Android控件开发——ListView
    Android服务开发——WebService
    Android开发学习路线图
    Android项目的目录结构
    Windows下搭建Android开发环境
  • 原文地址:https://www.cnblogs.com/yako/p/6020454.html
Copyright © 2011-2022 走看看