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>]

  • 相关阅读:
    Activity之间的数据传递
    解析JSON
    使用HTTP协议访问网路
    WebView的初体验
    Alarm机制用于定时服务
    IntentService和Service执行子线程对比
    前台服务
    Android四大组件之服务
    异步消息处理机制,UI更新
    Git学习
  • 原文地址:https://www.cnblogs.com/yako/p/6020454.html
Copyright © 2011-2022 走看看