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;