Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
Course Name Date Time Duration Type Location
An important update from QtpSudhakar. I stopped giving classroom training in MindQ Systems. I have bigger plans and I want to put an end to regular classroom training because very less people are practicing. From now onwards every session of mine is going to have explanation and practice. Everyone should practice in presence of mine and should go out of classroom with practical knowledge. So I started my own institute AnyTechLabs in Madhapur. Please reach out to +91-8328152362 for course details. Visit AnyTechLabs.com for address details.
Selenium + Cucumber 24th October 7.30 AM IST to 9.00 AM IST 45 Days WeekDay 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
Else
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

2 comments :

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

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

    ReplyDelete