[Collapse]TestComplete How To
 [Collapse]Web Utility Scripts
   Click a cell located in a specific HTML table row/support/viewarticle/24768/
   Convert a file to Base64/support/viewarticle/19898/
   Download a file from the Internet/support/viewarticle/8999/
   Get the page loading time/support/viewarticle/9043/
   Send an e-mail message/support/viewarticle/9020/
   Verify whether a web link is valid/support/viewarticle/9000/
 [Expand]Third-party Controls
 [Expand]MS Office
 [Expand]SQL
 [Expand]TestComplete Utility Scripts
 [Expand]Network
 [Expand]Windows Utility Scripts
 [Expand]Miscellaneous
Updated: 4/24/2012 Applies To: TestComplete Rating: AverageAverageAverageAverageAverage 8 vote(s) Click to rate: PoorNot badAverageGoodExcellent
Get the page loading time

The script below opens the http://www.automatedqa.com page and estimates how long the page is loaded. Open Internet Explorer before running the script.

VBScriptCopy Code

Sub Test
  Dim  iexplore, page, startTime, loadTime
  
  Set iexplore = Sys.Process("IEXPLORE")
  Set page = iexplore.Page("*")
  page.ToUrl("http://www.automatedqa.com/")
  page.Form("aspnetForm").Panel(1).Panel(0).Panel(1).Panel(0).Link(6).Click()
 
  startTime = GetTickCount()
  page.Wait()
  loadTime = GetTickCount() - startTime
  Log.Message("Page load time: " & loadTime & "ms")
End Sub

JScriptCopy Code

function Test()
{
  var  iexplore, page, startTime, loadTime;
  
  iexplore = Sys.Process("IEXPLORE");
  page = iexplore.Page("*");
  page.ToUrl("http://www.automatedqa.com/");
  page.Form("aspnetForm").Panel(1).Panel(0).Panel(1).Panel(0).Link(6).Click();
 
  startTime = GetTickCount();
  page.Wait();
  loadTime = GetTickCount() - startTime;
  Log.Message("Page load time: " + loadTime + "ms");
}


© 2012 SmartBear Software. All rights reserved.
Email Send feedback on this document