Free Software Testing Tutorial and Quality Assurance Portal
I'm going to explain and show QTP Descriptive Programming (DP) through Google Sets site:
The goal of the present QTP tutorial is to describe:
How to get number of controls (Links, Edits, Images, etc) with QTP DP.
Let's investigate Descriptive Programming on examples.
First of all, we should understand what Descriptive Programming means:
What is QuickTest Professional Descriptive Programming (QTP DP)?
Answer: QTP DP is a run-time processing of objects which are not located in QTP Object Repository.
I've created new QTP script which starts with http://labs.google.com/sets page.
This QTP script is simple enough:
Set Desc = Description.Create()
Desc("micClass").Value = "WebEdit"
Set Links = Browser("Google Sets").Page("Google Sets").ChildObjects(Desc)
MsgBox "Number of Edits: " & Links.Count
And its result is:
As you can see, it works correctly and returns correct number of Edits on a page.
I'm going to explain this QTP script and answer the following question:
I created the following simple VBScript for QuickTest Professional to extract number of pages in PDF file:
' Function GetNumPagesInPDF returns the number of pages in PDF file
' FileName - path to given ODF file
' If a file isn't found, then -1 will be returned
Function GetNumPagesInPDF(FileName)
Dim oPDFDoc
Set oPDFDoc = CreateObject( "AcroExch.PDDoc" )
If oPDFDoc.Open( FileName ) Then
GetNumPagesInPDF = oPDFDoc.GetNumPages()
Set oPDFDoc = Nothing
Else
GetNumPagesInPDF = -1
End If
End Function
Hi