Question

I am using Selenium webdriver, c# bindings and fiddler core. I am using fiddler core to get the response back from the image on the page of the application.

At the moment while I can output the targetSession.fullUrl for the url and the targetSession.status, for some reason its not matching for a logic test.

I'm out of ideas at the moment about why this is not working.

// Hook up the event for monitoring proxied traffic.
FiddlerApplication.AfterSessionComplete += delegate(Session targetSession)
{
    // Outputs the image url along with the other resources
    Console.WriteLine("Requested resource from URL {0} responseCode {1}",
    targetSession.fullUrl, targetSession.responseCode);

    // does output the one item with an response code that is not 200
   if (targetSession.responseCode != 200)
   {
    Console.WriteLine("Incorrect Status: {0}, {1}, {2} ", targetSession.fullUrl, 
    targetSession.responseCode, targetSession.RequestMethod);
   }

   // neither of these match the image url
   if (targetSession.fullUrl == targeturl && targetSession.responseCode == 200)
   {
    Console.WriteLine("Image is present: " + targetSession.fullUrl);
   }
   else if (targetSession.fullUrl == targeturl && targetSession.responseCode != 200)
   {
    Console.WriteLine("Image is not present: " + targetSession.fullUrl + 
    targetSession.responseCode);
   }
};
Was it helpful?

Solution

What are the expected and actual results? Did you maybe forget to enable HTTPS decryption? Did you check to see whether the URL on the page does a HTTP/3xx redirect to a different image?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top