0

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.

enter image description here

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;
Saifur
  • 16,081
  • 6
  • 49
  • 73

1 Answers1

1

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); };
EricLaw
  • 56,563
  • 7
  • 151
  • 196
  • Thanks Eric for your valuable time. I tried to do use your suggestion. Unfortunately for `http://the-internet.herokuapp.com/redirect` I get proper logging but not for `https://angularjs.org/`. JimEvan's application has a debug flag that I can use for debugging the session for `http://the-internet.herokuapp.com/redirect`. Seems like Fiddler application fails to attach event for `https://angularjs.org/`. I do not get any debugging information. – Saifur Jun 27 '15 at 23:46
  • Dozens or hundreds of FiddlerCore applications used by thousands of people work just fine with scenarios like this every day. Please update your code to show how you've updated it based on my response. – EricLaw Jun 30 '15 at 16:26