2011-08-02 74 views
0

我在我的Selenium項目中使用FiddlerCore。它捕獲所有的會話,但我不能執行導出 - DoExport方法總是返回false。你可以幫我嗎? 這裏是我的代碼:在FiddlerCore導出不起作用

 IWebDriver driver = new InternetExplorerDriver(); 

     Fiddler.FiddlerApplication.Startup(8877, FiddlerCoreStartupFlags.Default); 
     var items = new List<Fiddler.Session>(); 
     Fiddler.FiddlerApplication.AfterSessionComplete += delegate(Fiddler.Session oS) 
     { 
      items.Add(oS); 
     }; 


     driver.Navigate().GoToUrl("http://google.comm"); 

     FiddlerApplication.oTranscoders.ImportTranscoders(@"C:\\FiddlerCore-BasicFormats.dll"); 

     var oExportOptions = new Dictionary<string, object>(); 
     string filename = @"C:\output.har"; 
     oExportOptions.Add("Filename", filename); 
     Fiddler.FiddlerApplication.DoExport("HTTPArchive v1.2", items.ToArray(), oExportOptions, null); 

     Fiddler.FiddlerApplication.Shutdown(); 

回答

0

附加的事件處理程序,如下所示:

Fiddler.FiddlerApplication.OnNotification += delegate(object sender, NotificationEventArgs oNEA) { Console.WriteLine("** NotifyUser: " + oNEA.NotifyString); }; 
    Fiddler.FiddlerApplication.Log.OnLogString += delegate(object sender, LogEventArgs oLEA) { Console.WriteLine("** LogString: " + oLEA.LogString); }; 

...我敢打賭,你會發現一個控制檯通知表明您ImportTranscoders()調用失敗。