Jump to content

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


Recommended Posts

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]

Link to comment
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]

Link to comment
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]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...