Reputation: 16201
I am using a sample project from JimEvans named WebDriverProxyExamples. This project uses Selenium along with FiddlerApplication. So far I am satisfied what I have seen with the code and response codes. But, when I try to capture the response code of AngularJs landing page it fails to capture the response code and returns 0.
Edit: Fragment of codes I tried to use for debugging
SessionStateHandler responseHandler = delegate(Session targetSession)
{
if (printDebugInfo)
{
Console.WriteLine("DEBUG: Received response for resource with URL {0}", targetSession.fullUrl);
}
if (targetSession.fullUrl == targetUrl)
{
responseCode = targetSession.oResponse.headers.HTTPResponseCode;
Console.WriteLine(targetSession.oResponse.headers);
if (printDebugInfo)
{
Console.WriteLine("DEBUG: Found response for {0}, setting response code.", targetSession.fullUrl);
}
}
};
// Attach the event handler, perform the navigation, and wait for
// the status code to be non-zero, or to timeout. Then detach the
// event handler and return the response code.
FiddlerApplication.AfterSessionComplete += responseHandler;
driver.Url = targetUrl;
while (responseCode == 0 && DateTime.Now < endTime)
{
System.Threading.Thread.Sleep(100);
}
FiddlerApplication.AfterSessionComplete -= responseHandler;
return responseCode;
Upvotes: 0
Views: 281
Reputation: 57075
There are several possible explanations, including that you don't have the proper certificate generator (e.g. makecert.exe) located in the proper place. You should modify the WebDriverProxyExample code to hook up error handlers for display:
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); };
Upvotes: 1