【问题标题】:Browsermob Proxy - HAR file not as complete as manual HAR?Browsermob 代理 - HAR 文件不如手动 HAR 完整?
【发布时间】:2016-08-19 07:34:39
【问题描述】:

所以,下面是我尝试 Browsermob 代理的基本代码,并生成了输出。 问题在于输出,它似乎 (1) 数量不完整,并且 (2) 不如我在开发工具(Firefox 或 Chrome)中手动检查网络统计信息那么详细。

是否可以在 HAR 文件中包含更详细的信息? 我想知道,例如,是否已加载特定的 Javascript(或者是否有更好的解决方案?)。

        // Supply the path to the Browsermob Proxy batch file
        Server server = new Server(@"C:\Users\Frederik\Desktop\SeleniumTestje\browsermob-proxy-2.1.0-beta-6\bin\browsermob-proxy.bat");
        server.Start();

        Client client = server.CreateProxy();
        client.NewHar("google");

        var seleniumProxy = new Proxy { HttpProxy = client.SeleniumProxy };
        var profile = new FirefoxProfile();

        profile.SetProxyPreferences(seleniumProxy);
        // Navigate to the page to retrieve performance stats for
        IWebDriver driver = new FirefoxDriver(profile);
        driver.Navigate().GoToUrl("http://www.google.co.uk");

        // Get the performance stats
        HarResult harData = client.GetHar();
        foreach(Entry e in harData.Log.Entries)
        {
            Console.WriteLine(e.Request.Url, e.Request.Headers);
        }

控制台输出:

http://ocsp.digicert.com/
http://ocsp.digicert.com/
http://ocsp.digicert.com/
http://www.google.co.uk/
http://clients1.google.com/ocsp
http://clients1.google.com/ocsp
http://clients1.google.com/ocsp
http://clients1.google.com/ocsp

【问题讨论】:

    标签: c# selenium browsermob-proxy


    【解决方案1】:

    我在使用 Fiddlercore 时遇到了同样的问题,但我找到了解决方案: Fiddlercore - Requested resource URL's are generic (OSCP-related) instead of actual resource

    【讨论】:

      【解决方案2】:

      我也遇到了这个问题。它最终成为 Chrome 的网络工具,默认启用自己的缓存,因此 BrowserMobProxy 并不知道所有请求。

      要修复自动 .har 以使其与手动 .har 相同,请选中网络工具中的禁用缓存复选框。更多信息在这里:Disabling Chrome cache for website development

      【讨论】:

        猜你喜欢
        • 2016-10-09
        • 2019-02-02
        • 2023-03-29
        • 2019-12-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-11-04
        • 2019-12-10
        相关资源
        最近更新 更多