我正在尝试使用BrowserMob和Selenium获取此页面的内容,当我编写har文件时,我没有得到响应的内容。有人知道如何获取内容吗?
Server server = new Server("browsermob-proxy.bat");
server.Start();
Client client = server.CreateProxy();
client.NewHar("ip-api");
var seleniumProxy = new Proxy { HttpProxy = client.SeleniumProxy };
var profile = new FirefoxProfile();
profile.SetProxyPreferences(seleniumProxy);
IWebDriver driver = new FirefoxDriver(profile);
driver.Navigate().GoToUrl("https://ip-api.com");
HarResult harData = client.GetHar();
var json = new JavaScriptSerializer().Serialize(harData);
Log log = harData.Log;
Entry[] entries = log.Entries;
var file = new StreamWriter(@"file.har");
file.WriteLine(json);
foreach (var e in entries)
{
Request request = e.Request;
Response response = e.Response;
MessageBox.Show(response.Content.Text);
}