c# - Browsermob 代理 - HAR 文件不如手动 HAR 完整?

标签 c# selenium browsermob-proxy

所以,下面是我试用 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

最佳答案

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

关于c# - Browsermob 代理 - HAR 文件不如手动 HAR 完整?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36848563/

相关文章:

c# - 关于 DbSet 和 DbContext

c# - 有问题的组合框 Windows 窗体

c# - 自定义 ComboBox 样式看不到所选项目文本

selenium - 尝试远程运行 selenium 2 脚本

c# - 如何在 ios xamarin 的文本字段中禁用空格字符

selenium - 如何在appium中获取带有特定标签的ADB logcat?

java - 在 iframe 内导航后无法再次获取 iframe

python - 如何知道我的自定义 HTTP header 是否正在传递?

python-2.7 - HAR 响应中没有 header