Sign in to follow this  
Followers 0
sumit

code to return time taken by a page to load in IE

8 posts in this topic

Can anyone please give me the code to display in a message box the time taken to load a page in IE.

Thanks

Share this post


Link to post
Share on other sites



Can anyone please give me the code to display in a message box the time taken to load a page in IE.

Thanks

You might want to learn how to search the help file.

In this case, I searched for time and wait:

#include <IE.au3>

$begin = TimerInit()
$oIE = _IECreate("http://www.cnn.com")
_IELoadWait($oIE)
$dif = TimerDiff($begin)
MsgBox(0, "Time Difference", $dif)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Thanks a lot dear ..... Also your suggestion for searching helpfile is correct..... I tried to search but couldnt find it......thanks again

Share this post


Link to post
Share on other sites

The _IELoadWait($oIE) line is not needed as it is built into the _IECreate function via the IENavigate UDF.

#include <IE.au3>

$begin = TimerInit()
$oIE = _IECreate("http://www.cnn.com")
;_IELoadWait($oIE)
$dif = TimerDiff($begin)
MsgBox(0, "Time Difference", $dif)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

...and this version should take the browser window creation time out of the equation:

#include <IE.au3>

$oIE = _IECreate("about:blank")

$begin = TimerInit()
_IENavigate($oIE, "http://www.cnn.com")
$dif = TimerDiff($begin)
MsgBox(0, "Time Difference", $dif)


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Having walked you thru all of that, you might find it better to use InetGet and set the reload parm to "1 = Forces a reload from the remote site" to avoid IE temp file cache issues.

Also note that it takes time for a computer and browser to render (paint/show) the page you requested - meaning, if you use the _IECreate/_IENavigate method mentioned in my previous posts on slow hardware, you will see a difference in the "load time". The difference will be relative, so you might still find it of some use, but InetGet should be less influenced by hardware.

That "time to render" is part of this site's speed test:

http://www.numion.com/YourSpeed3/Select.php

See the brief explanation of MaxSpeed and SurfSpeed near the bottom of that page.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Thanks a lot

Share this post


Link to post
Share on other sites

Thanks a lot

You are welcome... but if you run this code, you might see that a lot of the variation is not the fault of the proxy.
TrayTip("", "working", 100)

$begin = TimerInit()
InetGet("http://infospeed.verizon.net/car/data5MB.zip", "tempfile", 1)
$dif1 = TimerDiff($begin)
TrayTip("", "time1  " & Int($dif1), 100)

$begin = TimerInit()
InetGet("http://infospeed.verizon.net/car/data5MB.zip", "tempfile", 1)
$dif2 = TimerDiff($begin)
TrayTip("", "time1  " & Int($dif1) & @CR & _
        "time2  " & Int($dif2), 100)

$begin = TimerInit()
InetGet("http://infospeed.verizon.net/car/data5MB.zip", "tempfile", 1)
$dif3 = TimerDiff($begin)
TrayTip("", "time1  " & Int($dif1) & @CR & _
        "time2  " & Int($dif2) & @CR & _
        "time3  " & Int($dif3), 100)

FileDelete("tempfile")

Sleep(22222)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0