How to get http request logs : Automation Tools

How to get http request logs

Ranorex Spy, Recorder, and Studio.

How to get http request logs

Postby bheemuabhigna » Mon Sep 05, 2011 10:02 am

Is it possible to get all httprequests of a browser

Eg: we have opened the browser, navigated to google.com, searched for a string, clicked on any link and I got some error
Now I want to track all httprequests from opening browser
We have been using fiddler, but our client wants this to be done by ranorex (so that when particular testcase fails it can send all session details also)

I have tried below with no success
public void httprequests()
{

string _url = repo.WebDocumentEzprints_ecommerce.Self.PageUrl.ToLower();
Uri _uri = new Uri(_url);
HttpWebRequest lWebRequest = (HttpWebRequest) WebRequest.Create(_uri);
HttpWebResponse lWebResponse = (HttpWebResponse)
lWebRequest.GetResponse();
//StreamReader lResponseStream = new StreamReader();
Encoding encode = Encoding.GetEncoding("utf-8");
//StreamReader(lWebResponse.GetResponseStream(),encode);
Stream receiveStream = lWebResponse.GetResponseStream();
//StreamReader reasstream = new StreamReader(receiveStream,encode);
StreamReader readStream = new StreamReader( receiveStream, encode );
Console.WriteLine("\r\nResponse stream received.");
Char[] read = new Char[256];
// Reads 256 characters at a time.
int count = readStream.Read( read, 0, 256 );
Console.WriteLine("HTML...\r\n");
while (count > 0)
{
// Dumps the 256 characters on a string and displays the string to the console.
String str = new String(read, 0, count);
Console.Write(str);
count = readStream.Read(read, 0, 256);
}
Console.WriteLine("");
lWebRequest = null;
lWebResponse.Close();
//lResponseStream.Close();
}

it is giving me th xml in viewsource.

Any information on this will be very helpful

Thanks,
Abhigna
bheemuabhigna
 
Posts: 42
Joined: Thu Feb 03, 2011 4:15 pm

Re: How to get http request logs

Postby Support Team » Mon Sep 05, 2011 3:49 pm

Hi,

I'm not sure if that's exactly what you want but have a look at following link:
http://stackoverflow.com/questions/5327 ... p-requests

Regards,
Tobias
Support Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation Tools

Who is online

Users browsing this forum: No registered users and 0 guests