问题
I'm following this blogpost to try and see what Fiddlercore does. The resulting console output, as per the blog, should be something like:
Requested resource from URL http://www.mozilla.org/
Requested resource from URL http://mozorg.cdn.mozilla.net/media/css/tabzilla-min.css?build=c2a3f7a
Requested resource from URL http://mozorg.cdn.mozilla.net/media/js/site-min.js?build=c2a3f7a
Requested resource from URL http://mozorg.cdn.mozilla.net/media/css/responsive-min.css?build=c2a3f7a
Requested resource from URL http://mozorg.cdn.mozilla.net/media/img/favicon.ico
Requested resource from URL http://www.mozilla.org/en-US/
However, in my case, the output has some rather generic URLs. I suppose there's something awry with my proxy, browser, ... settings somewhere? But I have no idea what. I'm trying to write code that waits for a specific resource to load, so the output below is not really useful.
Starting Fiddler proxy
Fiddler proxy listening on port 6143
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://www.mozilla.org/
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://vassg142.ocsp.omniroot.com/
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://clients1.google.com/ocsp
Requested resource from URL http://ocsp.digicert.com/
Requested resource from URL http://clients1.google.com/ocsp
Requested resource from URL http://clients1.google.com/ocsp
Requested resource from URL http://clients1.google.com/ocsp
回答1:
Got the same issue but resolved by switching to ChromeDriver and specifying ssl options:
server = new Server(@"C:\Users\<user>\Desktop\browsermob-proxy-2.1.4\bin\browsermob-proxy.
server.Start();
client = server.CreateProxy();
client.NewHar("Test");
var seleniumProxy = new Proxy { HttpProxy = client.SeleniumProxy, SslProxy= client.SeleniumProxy };
ChromeOptions co = new ChromeOptions();
co.Proxy = seleniumProxy;
co.AcceptInsecureCertificates = true;
driver = new ChromeDriver(co);
...
回答2:
Problem fixed. First of all, I didn't have the certificate installed but was fixed with this code:
if (!Fiddler.CertMaker.rootCertExists())
{
if (!Fiddler.CertMaker.createRootCert())
{
throw new Exception("Unable to create cert for FiddlerCore.");
}
}
if (!Fiddler.CertMaker.rootCertIsTrusted())
{
if (!Fiddler.CertMaker.trustRootCert())
{
throw new Exception("Unable to install FiddlerCore's cert.");
}
}
Secondly, I had to define the SslProxy for Selenium to capture HTTPS:
OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy();
proxy.HttpProxy = string.Format("127.0.0.1:{0}", proxyPort);
proxy.SslProxy = string.Format("127.0.0.1:{0}", proxyPort);
来源:https://stackoverflow.com/questions/36871647/fiddlercore-requested-resource-urls-are-generic-oscp-related-instead-of-act