Page 1 of 1
Page load time
Posted: Fri Aug 21, 2015 2:19 pm
by skhanpara
Hello,
We are doing some performance testing using Neoload. During that test we are planning to run a Ranorex script which will help use determine PageLoadTime. Is it possible to do so?
If Yes, can you suggest a proper way.
Thank you
Skhanpara
Re: Page load time
Posted: Fri Aug 21, 2015 2:43 pm
by skhanpara
I got the following code online and it works.
If you think there is a better way. Do let me know
Thank you
***************************************************************************************************************
WebClient client = new WebClient ();
// Add a user agent header in case the
// requested URI contains a query.
client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
Stream data = client.OpenRead (@"your-url-here");
StreamReader reader = new StreamReader (data);
string s = reader.ReadToEnd();
stopwatch.Stop();
Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);
data.Close();
reader.Close();