2016-04-26 50 views
0

我正在關注this blogpost以查看Fiddlercore的功能。 產生的控制檯輸出,按照博客的,應該是這樣的:Fiddlercore - 請求的資源URL是通用的(OSCP相關的)而不是實際的資源

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/ 

然而,在我的情況下,輸出有一些比較通用網址。我想我的代理,瀏覽器,...設置在某處出了問題?但我不知道是什麼。 我想寫代碼,等待加載一個特定的資源,所以下面的輸出是不是真的有用。

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 

回答

0

問題修復。 首先,我沒有安裝證書,但固定與此代碼:

 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."); 
      } 
     } 

其次,我不得不定義爲SslProxy硒捕捉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); 
1

得到了同樣的問題,但通過切換到ChromeDriver並指定SSL選項解決:

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); 
    ...