For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
New Schedule in MindQ Systems, Madhapur By SUDHAKAR
Course Name Date Time Duration Type Branch
UFT + UFTPro 20th September 2017 7.30 AM - 9.00 AM IST 25Days Classroom + Online Hitech City
Selenium+Appium 4th October 2017 4.30 PM - 6.00 PM IST 40Days Online -

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Monday, May 3, 2010

Scripting Page Checkpoint

A standard checkpoint applied on a web page object is called as page check point. A Page check point checks for 3 basic properties.

  1. Load Time
  2. Number of Links
  3. Number of images
These 3 properties will not be displayed in object spy / object identification window. But GetROproperty method will return the values of these properties.
lTime=Browser("Google").Page("Google").GetROProperty("load time")
lCount=Browser("Google").Page("Google").GetROProperty("number of links")
iCount=Browser("Google").Page("Google").GetROProperty("number of images")
Msgbox "Page Load Time="&lTime
Msgbox "Number of Links in Page="&lCount
Msgbox "Number of Images in Page="&iCount

The above code display the values of Page load time, Number of Links in Page and Number of Images in Page.
Now we can write a function to check these properties for any page object. Use below function to check page properties.

Function CheckPageProperties(oPageObject,eLoadTime,eNumberOfLinks,eNumberOfImages)
Dim aLoadTime
Dim aNumberOfLinks
Dim aNumberOfImages
Dim cDecription
aLoadTime= oPageObject.GetROProperty("load time")
aNumberOfLinks= oPageObject.GetROProperty("number of links")
aNumberOfImages= oPageObject.GetROProperty("number of images")
If aLoadTime=eLoadTime and aNumberOfLinks=eNumberOfLinks and aNumberOfImages=eNumberOfImages Then
Reporter.ReportEvent micPass,"CheckPageProperties","Page Load Time="&aLoadTime&vbnewline&_
"Number Of Links="&aNumberOfLinks&vbnewline&"Number Of Images="&aNumberOfImages
cDecription="&lt;<table border=1><tr><th>Property Name</th><th>Expected Value</th><th>Actual Value</th></tr>"&_
"<tr><td>Load Time</td><td>"&eLoadTime&"</td><td>"&aLoadTime&"</td></tr>"&_
"<tr><td>Number of Links</td><td>"&eNumberOfLinks&"</td><td>"&aNumberOfLinks&"</td></tr>"&_
"<tr><td>Number of images</td><td>"&eNumberOfImages&"</td><td>"&aNumberOfImages&"</td></tr>"&"</table>&gt;"
Reporter.ReportEvent micFail,"CheckPageProperties",cDecription
End If
End Function
'Using the above function
RegisterUserFunc "Page","CheckPageProperties","CheckPageProperties"
Browser("Google").Page("Google").CheckPageProperties 3,39,5
UnregisterUserFunc "Page","CheckPageProperties"
Please send your Suggestions and Doubts to my yahoo group http://in.groups.yahoo.com/group/qtpsudhakar


  1. I just love it..just awesome ..I like cDecription..Very good presentation of result page..thanks lot..

  2. why are you using opageobject,eloadtime not simple like page object..............