【问题标题】:What tools can I use to analyze Internet Explorer's network capture logs?我可以使用哪些工具来分析 Internet Explorer 的网络捕获日志?
【发布时间】:2012-01-11 02:32:07
【问题描述】:

我正在使用 Internet Explorer 9 中内置的 F12 开发人员工具来捕获站点上的网络流量。此信息可以保存到 XML(默认)或 CSV 文件。

XML 文件似乎包含更多信息,但我很难找到可以读取这些信息的应用程序。

Using Internet Explorer Developer Tools Network Capture 状态:

“保存”按钮使用 HTTP 存档架构或 .CSV 文件将当前 HTTP 会话写入 XML 文件。保存会话后,您可以使用任何可以读取 HTTP 存档文件或 .CSV 文件的工具打开会话。 Internet Explorer 9 可以导出您的数据,但它只能查看实时 HTTP 会话并且无法读取保存的文件。

但是,我在搜索 HTTP 存档架构时很难找到相关结果,虽然 CSV is nice,但它似乎缺少一些非常好的信息。 (我现在可能不需要这些额外信息,但将来可能会有用。)

是否有工具或资源(XSLT 或 LINQPad/.NET sn-p)可以在事后轻松解析这些信息?

【问题讨论】:

  • (如果有声望的人可以将此标记为 ie9-developer-tools(已经有一个 ie8-developer-tools),我将不胜感激。我认为 IE8 也内置了相同的功能,所以也许该标签也可以添加。)

标签: internet-explorer-9 ie-developer-tools


【解决方案1】:

这是一个在浏览器中显示 NetworkData.xml 的 XLST 示例,虽然不完整,但您会明白的。

编辑 NetworkData.xml 并添加

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="NDTable.xsl" ?>

开头

在 NDTable.xsl 中保存以下 XML

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html"/>
    <xsl:template match="/">
        <html>
            <xsl:apply-templates/>
        </html>

    </xsl:template>


    <xsl:template match="log">
        <head>
            <Title>
                <xsl:value-of select="creator/name"/>
            </Title>
        </head>
        <body>
            <h1>
                <xsl:value-of select="creator/name" />
            </h1>
            <P>Started at <xsl:value-of select="pages/page/startedDateTime" />
            </P>
            <table border="1">
                <tr>
                    <th>Request</th>
                    <th>Response</th>
                </tr>
                <xsl:apply-templates select="entries" />
            </table>
        </body>

    </xsl:template>

    <xsl:template match="entry">
        <tr> 
            <td>
                <xsl:apply-templates select="request" />
            </td>
            <td valig="top">
                <xsl:apply-templates select="response" />
            </td>

        </tr>


    </xsl:template>

    <xsl:template match="request">
        <table>
            <tr>
                <td valign="top">
                    <xsl:value-of select="method" />
                </td>
                <td>
                    <xsl:value-of select="url" />
                    <table>
                        <tr>
                            <th>Headers</th>
                        </tr>
                        <tr>
                            <td> </td>
                            <td>
                                <xsl:apply-templates select="headers/header[not(name='Cookie')]" />
                            </td>
                        </tr>
                    </table>
                    <table>
                        <tr>
                            <th>Cookies</th>
                        </tr>

                        <xsl:apply-templates select="cookies" />
                    </table>
                </td>
            </tr>
        </table>
    </xsl:template> 
    <xsl:template match="response">
        <table>
            <td>
                <xsl:value-of select="status" /> <span>.</span><xsl:value-of select="statusText" />
                <br/>
                    <table>
                        <tr>
                            <th>Headers</th>
                        </tr>
                        <tr>
                            <td> </td>
                            <td>
                                <xsl:apply-templates select="headers/header" />
                            </td>
                        </tr>
                    </table>
<div style='background-color: #C0C0C0'> <xsl:value-of select="content/text" /> </div>                   
            </td>
        </table>
    </xsl:template> 
    <xsl:template match="header">
        <xsl:value-of select="name" /> : <xsl:value-of select="value" />
        <br/>
    </xsl:template> 
    <xsl:template match="cookie">
        <tr>
            <td> </td>
            <td valign="top">
                <xsl:value-of select="name" />
            </td>
            <td>
                <xsl:value-of select="value" />
            </td>
        </tr>
    </xsl:template> 
</xsl:stylesheet>

【讨论】:

    【解决方案2】:

    Fiddler 现在可以读取这些,(但不能通过导入):

    1. 文件 > 导入会话
    2. 选择 IE 的 F12 NetXML 格式
    3. 选择正确的文件
    4. 利润!

    【讨论】:

      【解决方案3】:

      对于那些分析客户日志、没有 Windows 框来运行 Fiddler 的人...

      事实证明,IE 生成的 XML 只是 XML 中的 HAR,而不是 JSON 格式。我写了一个转换器把它变成一个普通的 HAR 文件: https://gist.github.com/craigds/00331c6ff8fd2334de68a52ef0cd79c2

      需要 python 和 LXML。

      【讨论】:

        【解决方案4】:

        Fiddler 确实支持按照its blog 导入 HTTP 存档 XML(从 IE9 开发人员工具网络选项卡导出)

        【讨论】:

        • 看看那个。很好的发现。尽管我想那时还不如只运行 Fiddler。谢谢!
        • 这很好。我们可以让我们的 QA 人员仅使用 IE 记录感知到的性能问题,并让他们将日志附加到我们的问题跟踪以供我们分析。
        猜你喜欢
        • 2022-06-23
        • 2011-01-05
        • 1970-01-01
        • 2010-10-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多