A standard checkpoint applied on a web page object is called as page check point. A Page check point checks for 3 basic properties.
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.
- Load Time
- Number of Links
- Number of images
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="<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>>"
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"
I just love it..just awesome ..I like cDecription..Very good presentation of result page..thanks lot..
ReplyDeletewhy are you using opageobject,eloadtime not simple like page object..............
ReplyDelete