Descriptive Programming is one of the most useful, simple yet often confused concepts of UFT One (formerly QTP). This article will serve as a complete guide on Descriptive Programming.
What is Descriptive Programming?
Descriptive Programming (also known as Programmatic Description) provides a way to perform operations on objects that are not present in object repository.
When and where is it used? How is it written? We will see complete details below.
Please note that the terms Descriptive Programming and Programmatic Description can be used interchangeably. We will be using the term Descriptive Programming throughout this guide.
When and Where to use Descriptive Programming?
Listed below are some of the situations where Descriptive Programming can be considered useful:
Handling Dynamic Object Property
One of the very useful places where you can use Descriptive Programming is when the object properties in the Application Under Test (AUT) are dynamic in nature and need special handling to identify the object. The best example would be of clicking a link which changes according to the user of the application.
As can be seen in the example above, the text property of Link object shown above changes according to the username. It is easier to handle such properties with descriptive programming.
Using External Function Library
Another place where DP can be of significant importance is when you are creating functions in an external file. You can use these function in various actions directly , eliminating the need of adding object(s) in object repository for each action. [If you use local object repository]. This forms the basis of keyword driven framework approach.
Huge Object Repository
When object repository is getting huge due to the number of objects being added. Bulky object repository may decrease the performance of UFT One (QTP) while recognizing an object. [For QTP 8.2 and below, Mercury – which was subsequently acquired by HP – used to recommend object repository size less than 1.5 MB]
When Application is Not Ready Yet
Suppose we have a web application that has not been developed yet. Now for QTP to record the script and add the objects to repository, needs the application to be up, that would mean waiting for the application to be deployed before we can start making QTP scripts. But if we know the descriptions of the objects that will be created, we can start-off with the scripts using Descriptive Programming.
Object Repository in read only or shared mode
Let’s say you wish to modify a QTP script but the Object repository for the same is read-only or in shared mode i.e. changes may affect other scripts as well. In such a case, you may use Descriptive Programming approach.
Several Identical Objects needing Same Operations
On the Same Page: Suppose we have 15 textboxes on a web page and there names are in the form txt_1, txt_2, txt_3 and so on. Now adding all 15 objects in the Object repository would not be a good programming approach (since the object description would be the same except the index ordinal identifier.) We can simple go for Descriptive Programming.
On Different Pages: Suppose a web application with several pages has 3 navigation buttons on each page. Let the buttons be “Cancel”, “Back” and “Next”. Now recording action on these buttons would add 3 objects per page in the repository. For a 10 page flow, it would mean 30 objects which could have been represented just by using 3 objects. So instead of adding these 30 objects to the repository, we can write 3 descriptions for the object and use those descriptions on any page.
How to write Descriptive Programming?
It should be noted that Descriptive Programming can be used across technologies and add-ins in UFT One (QTP). It is not limited to a particular technology. In the examples that follow, we will use web based objects.
There are two ways to create Descriptive Programming statements:
1. By giving description in form of the string arguments. (also known as inline Descriptive Programming or static Descriptive Programming)
This is a commonly used method for writing Descriptive Programming statements.
In this method, property:=value pairs describe the object. The general syntax for inline descriptive programming is:
TestObject("PropertyName1:=PropertyValue1", "PropertyName2:=PropertyValue2",……, "PropertyNameN:=PropertyValueN")
where
- TestObject — is the test object class. This could be Browser, WebEdit, WebRadioGroup etc
PropertyName:=PropertyValue
— is the test object property-value pair. Each property:=value pair should be enclosed in quotes and separated with other pairs with a comma. Property and its value is separated with a colon(:) and equals to (=) sign. There should be no space between the := sign and property-value pair hence whileTestObject("PropertyName1:=PropertyValue1")
is acceptable, but this isn’tTestObject("PropertyName1 := PropertyValue1")
Example:
Let us write an inline descriptive programming statement for username box of demo flight reservation application.
A normal recorded statement for username would like
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "mercury"
We will create a DP statement in place of the recorded statement above. Here is the generic process that one should follow.
- Record the object for which you wish to write a DP statement.
- Open the repository corresponding to the object(s).
- Note the property-value pairs used by QTP to identify the object.
- Write them using the syntax discussed above.
QTP does not record any property for a browser or a page object.
For a browser object, there is no other property required in case you are dealing with a single browser.
Browser object shown above can be written as Browser("micclass:=Browser")
Page object shown above can be written as Page("micclass:=Page")
WebEdit object shown above can be written as
WebEdit("type:=text","name:=userName","html tag:=INPUT")
If you notice we have not written, miclass property-value pair for this object type. Actually micclass is an implicit property which is taken automatically since QTP assumes that based on the test object type being referenced. In case of Browser or page object, you can provide any one such implicit property.
micclass, html tag are some examples of implicit properties.
Putting it all together, the statement above would look like this when written in Descriptive Programming
Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("type:=text","name:=userName","html tag:=INPUT").Set "mercury"
Copy Identification Properties to Clipboard
In UFT 11.5 and above, you can also use the Copy Identification Properties to Clipboard option in the Object Spy dialog box to copy all identification property-value pairs for a selected object to the clipboard.
The copied values are formatted in standard DP syntax with line breaks between each property-value pair.
You can paste the copied data to any document and then copy selected lines – after removing the line breaks- into a DP statement. Please note that you won’t be using ALL the properties to identify the object. As a rule of thumb, you should use a minimum set of properties to identify an object.
2. By creating properties collection object for the description. (also known as dynamic Descriptive Programming)
Properties collection does the same thing as string arguments. The only difference is that it “collects” all the properties of a particular object in an instance of that object. Now that object can be referenced easily by using the instance, instead of writing “string arguments” again and again. It is my observation that people find 1st method easier to work with.
The process of writing DP statements remains almost the same as inline DP. However, in this case the property value pairs are written as part of a description object.
Example
For this example, we will create a description object for WebEdit.
Dim oDesc ‘Declare an object variable Set oDesc = Description.Create ‘Create an empty description
Now we have a blank description in “oDesc”.
oDesc("type").value= "text" oDesc("name").value= "userName" oDesc("html tag").value= "INPUT"
The statement above would look like this when written using this approach.
Browser("Browser").Page("Page").WebEdit(oDesc).Set "mercury"
Note for advanced users: Each description object’s property supports a value as well as a RegularExpression assignment. If the name value above was username786 and you wanted the last three digits as a regular expression, you could write the same statement as
oDesc("name").value= "userName\d\d\d"
If you wish to turn off regular expression property for a particular property you can use
oDesc("name").RegularExpression= False
Using Regular Expressions in Descriptive Programming
Both the forms described above support usage of Regular Expressions by default. Check our regular expressions guide if you wish to learn about them in detail.
The first image shown at the top has a dynamic username. If you wish to identify that username as a regular expression using inline descriptive programming, it can be written as
Browser(“QTP Training”).Page(“QTP Training”).Link(“text:=Go To Next Page user\d\d\d”, “html tag:=A”).Click
Using dynamic DP, it would be written as
Dim oDesc ‘Declare an object variable Set oDesc = Description.Create ‘Create an empty description oDesc("text").value= "Go To Next Page user\d\d\d" oDesc("html tag").value= "A" Browser("QTP Training").Page("QTP Training").Link(oDesc).Click
Using Variables in Descriptive Programming
In the example mentioned above, if you wish to substitute a variable instead of using a regular expression, it can be written as
Dim uName uName = user786 Browser("QTP Training").Page("QTP Training").Link("text:=Go To Next Page "&uName, "html tag:=A").Click
Using Ordinal identifiers in Descriptive Programming
You can also use any of the three ordinal identifiers (index, location, creationtime) in Descriptive Programming. If you have 2 username boxes one below the other in mercury demo app, they can be written as –
Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("type:=text","name:=userName","html tag:=INPUT","index:=0").Set "mercury" Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("type:=text","name:=userName","html tag:=INPUT","index:=1").Set "mercury"
UFT Insight with Descriptive Programming
UFT provides ImgSrc property to use in an Insight object in Descriptive Programming. Inline method of DP uses “property:=value” pair. In case of Insight object, property can be ImgSrc with values as the image location on a file system (or an ALM path). You can also optionally use index or location ordinal identifiers or similarity as one of the properties in an Insight object.
Here is an example of using ImgSrc in DP.
Window("Calculator").InsightObject("ImgSrc:=C:\UFTFiles\number1.png").Click
Important points to note while using Insight with Descriptive Programming.
- The image file should be accessible from the machine that runs the test. The file location can be either the local machine or ALM. It can not be a random site on the internet.
- The file must be a non-compressed image file that supports 24/32 bits per pixel and can have an file name extension of jpeg, bmp or png
- The ImgSrc property is mandatory.
- You can optionally use ordinal identifiers like index or location.
- You can optionally use similarity property with possible values ranging from 1-100. Similarity property specifies in percentage how similar a control in the application has to be to the test object image for it to be considered a match. The default value is 80.
- The ImgSrc property does not support regular expressions.
- The Click method would click in the center of the image when you use Descriptive Programming on an Insight object.
To learn more about UFT Insight , check this complete guide to UFT Insight
Some important points to note with Descriptive Programming.
- When using Descriptive Programming from a specific point within a test object hierarchy, you must continue to use Descriptive Programming from that point onward within the same statement. If you specify a test object by its object repository name after other objects in the hierarchy have been described using Descriptive Programming, QTP will not be able to identify the object.
For example, you can use Browser(Desc1).Page(Desc1).Link(desc3), since it uses Descriptive Programming throughout the entire test object hierarchy.
You can also use Browser(“Index”).Page(Desc1).Link(desc3), since it uses Descriptive Programming from a certain point in the description (starting
from the Page object description).
However, you cannot use Browser(Desc1).Page(Desc1).Link(“Example1”), since it uses Descriptive Programming for the Browser and Page objects but
then attempts to use an object repository name for the Link test object (QTP tries to locate the Link object based on its name, but cannot
locate it in the repository because the parent objects were specified using Descriptive Programming). - UFT One (QTP) evaluates all property values in Descriptive Programming as regular expressions. Therefore, if you want to enter a value that contains a special regular expression character (such as *, ?, or +), use the \ (backslash) character to instruct QTP to treat the special characters as literal characters.
In the above example, if we had parenthesis around username, it would have been written asBrowser("micclass:=Browser").Page("micclass:=Page").WebEdit("type:=text","name:=\(userName\)","html tag:=INPUT").Set "mercury"
since parenthesis is a special regular expression character and in this case you would want to treat it as a literal.
- micclass is shown as Class Name in object spy. If you use Class Name in DP, QTP will throw an error. Make sure to use micclass. Check Class Name vs Class vs micclass in QTP.
- Somehow there is a myth in QTP community that DP can be used when QTP is unable to identify an object using normal means. Descriptive Programming provides a way to bypass object repository and gives a bit of flexibility to identify the object. However, if even after adding appropriate add-ins you are unable to identify an object using normal means, don’t assume that DP can come to your rescue and magically start identifying objects.
That brings us to the end of exhaustive guide on Descriptive Programming. We recommend you to re-read this article several times to comprehend the topic properly.
Do comment below if you have any questions.
Hi Ankur,
recently I faced very strange issue.
We created dynamic description for object identification. It worked on my machine but not on his.
code was like this
set oDes=description.create
oDes("innertext").value="Search"
oDes("html tag").value="a"
Set OChld=Browser("").Page("").childobject(oDes)
please ignore any syntax, this I just typed , it is similar
What can be the reason.
I suspected smart identification , but that was not the case
Please help !!
When you talk about DP, Smart Identification is ruled out. Would need to check the exact code to find out the issue. Please write your detailed query on the VB/DP forums.
Hi,
I have 2 tabs in my application with same properties. While using descriptive programming, can you please see if this is the correct way?
PbWindow("pbname:=xxx_w_frame").PbWindow("pbname:=w_transaction_details").PbTabStrip("window id:=1000","pbname:=tab_1","nativeclass:=PBTabControl32_100","Type:=Location","Value:=1").Select "Address"
PbWindow("pbname:=acis_w_frame").PbWindow("pbname:=w_transaction_details").PbTabStrip("window id:=1000","pbname:=tab_1","nativeclass:=PBTabControl32_100","Type:=Location","Value:=1").Select "Location"
it’s solved
Can any one help me with this below line of code. This is simple login with Descriptive Programming. As I m learning new can anyone help on this:
InvokeApplication "C:\Program Files\Internet Explorer\iexplore.exe https://uhgvision-q1.uhg.com/"
Browser("title:=Enterprise System Login Page").Page("title:=Enterprise System Login Page").WebTable("name:=WebTable").WebTable("name:=1ptrans").WebEdit("name:=ctl00$MainContent$uxUserNameText").Set "a1005"
Browser("title:=Enterprise System Login Page").Page("title:=Enterprise System Login Page").WebTable("name:=WebTable").WebTable("name:=1ptrans").WebEdit("name:=ctl00$MainContent$uxPasswordText").Set "a1005"
Browser("title:=Enterprise System Login Page").Page("title:=Enterprise System Login Page").WebTable("name:=WebTable").WebTable("name:=1ptrans").WebButton("name:=Submit").Click
@archana: I see some reserved characters inside the DP arguments. You need to escape them.
Consider below snippet
blnExist = Page(“title:=.*”).Exist
blnExist evaluates to true, my query is that; is Browser() is not required as parent hierarchy for Page. If not what is the logic behind of directly using
Page(“title:=.*”).Exist
and not
Browser(“”).Page(“title:=.*”).Exist
It would be helpful to understand the working of this.
@Nagaraj: This blog post from Motti should answer your question. I am putting the relevant extract for your reference.
Please send me a sample mock paper .
@Nagaraju: Sure. Go to UFT Certification guide At the bottom , enter your name and email in the form provided and you will get instant access to the free sample mock paper.
This is a great web page! if anyone from Xavient is visiting this site then my course on UFT wasn’t adequate.
@Raj: Glad you are loving the site.
Please give me a solution for finding link text in web application which is not possible to find by object spy and recording.
@Aneesh: Please ask your detailed query on QTP/UFT forums
please give me how to write code for entering the data to a java based windows application and to fetch the data from external data sheet..in my code the values are not entering..but there is no error in my program.even if i’m recording & run the program also, the values are not entered?how is it possible?if there is error in my program it’s ok but it is not even working in record & run.!
@Aravindh: Please open a new thread on QTP/UFT forums and let us know in detail about the issue and the code you are using.
Hi Ankur ,
Am working as a Test Engineer in XYZ company , I need to know automation scripts can be run in minimized screen ? Means in virtual machine . From my local machine connecting to Virtual machine , then i will start execution in virtual machine . Then can i minimize Virtual machine screen ? Is there any tool ?
Thnaks & Regards,
Santhosh
Hi Ankur,
Can you please provide me some solutions how to handle/edit shared object repository if it is locked by some other user?
I mean ,i need to add/modify objects in SOR(which is used by some other users at the same time).While i am editing it is displaying the pop-up like “SOR is locked by username(Ex-Ankur)”.
Best Regards,
Ashok
When I am using browser.page.object.cookie , then it will have the cookie reference. Whether it is a session cookie or a persistant cookie.
Hi ,
I want to automate my application (windows based) using descriptive programming. Im facing a problem where i want to double click on an object because its x,y values are dynamically changing.
How can I resolve this ? Can anybody help ???
‘1 “UFT Dynamic Descriptive Program for Click on OK Cancel and Help Button ”
SystemUtil.Run”C:\Program Files (x86)\HP\Unified Functional Testing\samples\flight\app\flight4a.exe”
Set DesObj=Description.Create
Set DesObjCh=Dialog(“text:=Login”).ChildObjects(DesObj)
msgbox DesObjCh.Count
DesObj(“nativeclass”).Value=”Button”
Set DesObjCh=Dialog(“text:=Login”).ChildObjects(DesObj)
msgbox DesObjCh.Count
For i = 1 to DesObjCh.Count
Dialog(“text:=Login”).Activate
Dialog(“text:=Login”).WinEdit(“attached text:=Agent Name:”).Set “Nilesh”
Dialog(“text:=Login”).WinEdit(“attached text:=Password:”).Set “mercury”
If i=1 Then
dialog(“text:=Login”).WinButton(“text:=OK”).Click
window(“text:=Flight Reservation”).Activate
Window(“text:=Flight Reservation”).winedit(“acx_name:=MaskEdBox”).Set “12/12/15”
window(“text:=Flight Reservation”).WinComboBox(“attached text:=Fly From:”).Select “Denver”
window(“text:=Flight Reservation”).WinComboBox(“attached text:=Fly To:”).Select “London”
window(“text:=Flight Reservation”).WinButton(“text:=Flight”).Click
Window(“text:=Flight Reservation”).dialog(“regexpwndtitle:=Flights Table”).WinButton(“text:=OK”).Click
window(“text:=Flight Reservation”).winedit(“window id:=1014”).Set “Nilesh Banjare”
window(“text:=Flight Reservation”). winButton(“text:=&Insert Order”).click
Window(“text:=Flight Reservation”).Close
Systemutil.Run”C:\Program Files (x86)\HP\Unified Functional Testing\samples\flight\app\flight4a.exe”
ElseIf i=2 Then
Dialog(“text:=Login”).WinButton(“text:=Cancel”).Click
Systemutil.Run”C:\Program Files (x86)\HP\Unified Functional Testing\samples\flight\app\flight4a.exe”
elseif i=3 Then
dialog(“text:=Login”).WinButton(“text:=Help”).Click
End If
Next
Thanks,
Nilesh Banjare
hi Ankur,
i want to know about X-path descriptive programming.
please help!
thanks
raji
Can I start QTP scripting even if my page(Oracle forms) is not ready? At what stage of testing life cycle we can start QTP scripting?
@DP: Depends upon your choice of framework, it can be done when the app is manual test ready.
without the page is ready can we start QTP scripting using Descriptive Programming? In that case what can be the prerequisites?
1) I need to know how to do a bitmap checkpoint validation using descriptive progamming.
2) is it good to use UFT feature to valiadtae bitmap or by using descriptive?
3) i am really compfortable in doing automation using descriptive prog. but in interviews they will be asking more questions on generic UFT feature.How to handle that?
@Suresh: Anything that is done with OR can be done with DP.
All I can say is that prepare to enhance your knowledge not for the interview.
hi there,
i want to know about X-path descriptive programming.
please help!
thanks
raji
Hi,
I would like to switch off Regular expression(=False) in static DP. Is there a way out?
Hi Anukar,
I am fallowing you for QTP from so many days,
I would like to thank you and your effort for keeping this blog so intense and intellectual, I have some basic question, it is related to qtp-version-10, [QTP v.10], can i use css and Xpath for locating elements in QTP-10, please give your valuable inputs for the same.
Thank and Regards
Shivanand H
I am not able to click on a web button through automation. The button works fine when running manually. The button is also identified by QTP. It is highlighting the object on the application. But the Webbutton(“log in”).click is not progressing on the applictaion. Please see the properties of teh object below :
“Class Name:=WebButton”,
“abs_x:=1769”,
“abs_y:=410”,
“class:=wideButton”,
“disabled:=0”,
“height:=31”,
“html id:=form_button_login”,
“html tag:=BUTTON”,
“innerhtml:=Log in”,
“innertext:=Log in”,
“name:=Log in”,
“outerhtml:=Log in”,
“outertext:=Log in”,
“title:=”,
“type:=button”,
“value:=Log in”,
“visible:=True”,
“width:=260”,
“x:=489”,
“y:=331”
Please help. Please let me know if you need any more details.
It does not seem to be a problem, anyway, it does. hah?
You might like to try change the value of the ‘name’ attribute of the object.
In my OR, all objects’name are redefined with the convention like _ for e.g. bt_LogIn.
Browser(“title:=Gmail: Email from google”).page(“title:=Gmail: Email from google”).webbutton(“name:=Login”).click
I faced a similar issue some time back.. resolution i found was..
1. Include the property “Visible=True” in the mandatory properties.
2. Turn the Smart Identification False.
Hi Ankur,
I am new to QTP and following this website religiously to learn it. But have a problem understanding a topic and was wondering if you could help in explaining it in a better way. Also, the name of the 3rd Ordinal is missing.
“Ordinal Identifiers in Descriptive programming”
You can also use any of the three ordinal identifiers (index, location, in descriptive programming. If you have 2 username boxes one below the other in mercury demo app, they can be written as –
Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“type:=text”,”name:=userName”,”html tag:=INPUT”,”index:=0”).Set “mercury”
Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“type:=text
FLIGHT Descriptive Programming Object repository in VB Script
Dt: 01/11/2010
1.1 How to Capture object properties in Vbs file?
All FLIGHT application’s objects properties should be captured in the file FLIGHT_VbsObjRep.vbs. In the main function called “VbOrMainFunc(), we will pass two parameters, ObjCls and ObjectAliasName (eg. VbOrMainFunc(ObjCls,ObjectAliasName)).
Using ObjCls parameter we pass the exact “Class name” property value of any object ( Pbwindow, Window, PbObject, Pbedit…….)
Sample code of FLIGHT_ObjRep.vbs
REM Vbs Object Repository For FLIGHT
MaxArray = 400 REM 400 is the Maximum array range.
Public Function VbOrMainFunc(ObjCls,ObjectAliasName)
ObjName = Split(Trim(ObjectAliasName),”,”) REM Splitting the ObjAliasName with “,” Delimiter
ObjClsName = ObjName(0) REM ObjClsName – Contains the alias name
REM Splitting the Classname with “,” Delimiter and assign it to AppObjType
AppObjType = Split(“PbWindow,Window,PbObject,PbEdit,PbList,PbButton,PbLabel,winbutton,wincombobox,dialog,WinEdit,WinList,WinObject,VbWindow,ActiveX,WinRadioButton,PbEditor,PbRadioButton”, “,”)
REM Array Declaration for function – All the functions are stored in array
ObjFunc = Array(“FetchMainWin(ObjClsName)”,”FetchWdw(ObjClsName)”,”FetchPbObj(ObjClsName)”,”FetchPbEdit(ObjClsName)”,”FetchPbList(ObjClsName)”,”FetchPbBtn(ObjClsName)”,”FetchPbLbl(ObjClsName)”,”FetchWinBtn(ObjClsName)”,”FetchWinCombx(ObjClsName)”,”FetchWinDlg(ObjClsName)”,”FetchWinedit(ObjClsName)”,”FetchWinList(ObjClsName)”,”FetchWinObject(ObjClsName)”,”FetchVbWindow(ObjClsName)”,”FetchActiveX(ObjClsName)”,”FetchWinRdBtn(ObjClsName)”,”FetchPbEditor(ObjClsName)”,”FetchPbRdBtn(ObjClsName)”)
REM The below code will search for the “Class Name” and it will call the respective function
For i = 0 To UBound(AppObjType)
If LCase(AppObjType(i)) = LCase(ObjCls) Then
Objppt = Eval(ObjFunc(i))
Exit For
End If
Next
REM Assign the Dynamic Properties
If LCase(Objppt) “fail” Then
Set AppObj = Description.Create
Objppt1 = Split(Objppt,”,”)
For i = 0 To UBound(Objppt1)
Objppt2 = Split(Objppt1(i),”:=”)
If UBound(Objppt2) > 1 Then
AppObj(Trim(Objppt2(0))).value = Trim(Objppt2(1))&”:”
Else
AppObj(Trim(Objppt2(0))).value = Trim(Objppt2(1))
End IF
Next
Set AppMainFunc = AppObj
Else
Set AppObj = Description.Create
Set AppMainFunc = AppObj
End If
End Function
REM Sample code of FLIGHTObjRep for Main window – REM This function (Array(1)) is to add all Pbwindow Properties.
Public Function FetchMainWin(PbWinfetchtxt)
ReDim mwdw(MaxArray,1)
mwdw(0,0)=”AppWindow”
mwdw(0,1)=”Class Name:=PbWindow,nativeclass:=FNWNS390,pbname:=w_login,regexpwndtitle:=Welcome”
MainWindo = Checkppt(mwdw,PbWinfetchtxt)
Erase mwdw
FetchMainWin = MainWindo
End Function
REM Checkppt is the function to search for the Alias name in the array.
Public Function Checkppt(ValArray,srchtxt)
val =””
For i = 0 To UBound(ValArray)
If LCase(ValArray(i,0)) = LCase(srchtxt) Then
val = ValArray(i,1)
Exit For
End If
Next
REM When alias name is found it return the property for that object, else it returns fail.
If val “” Then
Checkppt = val
Else
Checkppt =”Fail”
End If
End Function
1.2 How to write script using FLIGHT_vbsObjRep.vbs in UFT?
FLIGHTObjRep.vbs contains the object properties of FLIGHT application. We use FLIGHTObjRep.vbs to write any action script. (eg. Launch application, Create member … close application.
Sample Script to launch application:
LaunchFLIGHT()
Public Function LaunchFLIGHT() ‘//Launching the FLIGHT Application
SystemUtil.Run “C:\Flight\Testing\ Flight.exe”,” “,”C:\Flight\Testing\”,””
Set oMainWin = PbWindow(VbOrMainFunc(“PbWindow”,”AppWindow”))
Do Until oMainWin.Exist
Wait(1)
Loop
If oMainWin.Exist(1) then
Reporter.ReportEvent 0, “Window Availability”, “Window is Available”
Else
Reporter.ReportEvent 2, “Window Availability”, “Window is NOT Available”
End if
End Function
This VB script file is an alternate of UFT\QTP object repositories….
I have used the DP in my project . Now the objects property is changing frequently, SO i have to update the property of the same object in all test cases. Is there any way that we can create the all objects in one place (something like seleium using java ) and just use that object in test.
Hi Sir,
Am trying to signup a new user in Gmail using QTP.
After entering gmail address it displays the list of available user id’s as links.
Can you plz send me the test script to select the availability user link.
Thanks,
Priyanka.
Hi Priyanka,
you can try this
Set odesc=Description.Create()
odesc(“micclass”).value=”link”
Set l_link=Browser(“a”).Page(“b”).WebTable(“c”).ChildObjects(odesc)
For i=0 to l_lionk.count-1
link_Title=l_link(i).GetROProperty(“innertext”)
If link_Title=”XX” Then
l_link(i).Click
End If
Next
hi ankur…ur blog is xcellent …any updates in qtp scripts please make a notice 2 me via mail….
thanks ®ards
udaykiran
Excellent and easy way to learn :).
Can any one include Ankur, explain how DP can be used in Reports?
Hi Ankur,
The following code says me Object required
str=”Browser(“”Servi””).Page(“”Servi””).Link(“”name:=Home””)”
Execute str.Click
even
Set str=”Browser(“”Servi””).Page(“”Servi””).Link(“”name:=Home””)”
does not work. Please help
Thanks
I got the solution Ankur, I should have used
Execute str &”.”&”Click”
Thanks
I am automating Oracle Apps. I need to automate one table. Object recognization was showing till
OracleFormWindow(“Detail Balances”).OracleTable(“Table”).EnterField
I need to verify the table values.I am unable to get the get the coloum value and get the row values. please help me how to automate using descriptive programming.
@Murail: Please write your detailed query on forums.
Hi Ankur,
I was trying to write DP which has WebTable objects,but was not able to add run this code .can you let me know if there is some type of special handeling with Webtables in DP.
@Rahul: No special handling for web tables. Just follow the method described above.
hi all i am new to qtp and shall i have any user quide pdf. if any one has pdf please forward it to my mail
@vijay: A tutorial for QTP comes with QTP installation itself. Please have a look.
Hi Ankur,
Thanks for the simplified explanation of descriptive programming.
I have a question about the following:
If we refer to them as a web element then we will have to distinguish between the 2 using the index property
To determine which property and value pairs to use, you can use the Object Spy:
1. Go to Tools -> Object Spy.
2. Select the “Test Object Properties” radio button.
3. Spy on the desired object.
4. In the Properties list, find and write down the properties and values that can be used to identify the object.
When I use object spy to spy on 2 different links on the google homepage, I don’t see any property by the name of “index” shown by Object Spy. So, how can I find out the complete list of properties associated with an object?
As an example, I have pasted the properties (using object spy) of the username and the password webedit boxes of the first page of newtours.demoaut.com webpage below.
Class Name:=WebEdit,
Class Name;WebEdit
abs_x:=524,
abs_x;524
abs_y:=414,
abs_y;444
class:=,
class;
default value:=,
default value;
disabled:=0,
disabled;0
height:=22,
height;22
html id:=,
html id;
html tag:=INPUT,
html tag;INPUT
innerhtml:=,
innerhtml;
innertext:=,
innertext;
kind:=singleline,
kind;singleline
max length:=2147483647,
max length;2147483647
name:=userName,
name;password
outerhtml:=<INPUT size=10 name=userName>,
outerhtml;<INPUT value="" size=10
type=password name=password>
outertext:=,
outertext;
readonly:=0,
readonly;0
rows:=0,
rows;0
type:=text,
type;password
value:=,
value;
visible:=True,
visible;True
width:=87,
width;87
width in characters:=10,
width in characters;10
x:=524,
x;524
y:=249
y;279
Hello Ankur,
I read some other sites for QTP which mentions Static & Dynamic programming for Descriptive programming
Can i correlate
“Static DP” as “By giving the description in form of the string arguments.”
&
“Dynamic DP” as “By creating properties collection object for the description”
Please clarify
Great help, dude.
Hi Ankur,
1)how to retrieve the values from GRID…?
2nd question, but qtp recognizes that is not a grid , that is a web element? what u do?
pls post ans its urgent
thanks in advance
Hi Ankur,
I have a Telerik control(a weblist) in my application and QTP doesn;t support that. Then how can I automate the weblist in my project. I tried recording but QTP is not identifying that control. Please help.
Hi Ankur,
I’m new to QTP. Learning DL. I’m trying to write DP for Radio button(One way,Round Trip) in Reserve flight web application and it is giving an error “cannot identify the object (webElement)(of class WebElement) Verify the object properties.
Please help me
Thanks
The blog is very useful , i learnt a lot on dp
I am getting ‘General Error’ when trying to retrieve the current URL in the browser address bar using DP.
Below is the code snippet:
strBrowserTitle = Browser(“Index:=0″).GetROProperty(“title”)
strPageTitle = Browser(“Index:=0″).Page(“Index:=0″).GetROProperty(“title”)
strNewURL = Browser(“title:=”&strBrowserTitle&””).Page”title:=”&strPageTitle&””).GetROProperty(“url”)
This last line of code gives this error. Also tried the below variation but again getting the same error:
strNewURL = Browser(“title:=”&strBrowserTitle&””).Page”title:=”&strPageTitle&””).Object.URL
I want to compare two website…old and new…i want to copy text from old and new one and compare both text file..
very clear thank u need to practice
hi Ankur thanks for giving the clear picture of descriptive programming but what is the easiest way to write descriptive programing.And how does it help full in real time
Hello,
M facing a very weird issue with QTP 9.5 with javaswing applications.
I have a javatable, through the object repository, QTP identifies the Javatable perfectly.But then if I use a descriptive string to identify the same javatable, QTP fails to do so.It says object does not exist.
Please help.
HI,
is there any way that we can click on retry button, of run time error box of qtp? Please give me that code
Thanks
Hi,
I am trying to capture .Frame property within the secure log in site once logged into SAP portal to use during my Automated testins using QTP and Visual Basic. Could you please help.
THank you.
Hi Ankur,
Am automating Web-SAP application and object identification is taking lot of time. Webtable identification is taking more than 2 miniutes to identify and system hangs. Am using QTP 10.0 and IE 7. Can you tell how to uniquely identify the objects faster. I tried record and play, also changing the object identification properties to uniquely identify and still no use. Actually i have webtable which frequently changes with the data selection/updation. You can mail me at xeconio@gmail.com
How we can use descriptive programming for web object->Frame in QTP.
Please suggest.
Thank You
HI,
plz send some of the challenges u faced in web application and how to find the hidden botton while scrolling in descriptive
Hi,
Please tell me If I am using JAVA application but having web addin, is it possible? If yes, how and what are the shortcomings?
Hi Ankur,
It is really a good example to understand the descriptive programming but I am facing the problem to click on a WebElement which comes under multiple WebTables like Browser->Page->WebTable->Webtable->WebTable->WebTable->WebElement.
I want to read on the WebElement which is following the above hierarchy. So I will be very thankful if you will help me to get rid from this problem and provide me the solution.
Hi Ankur,
Great article! Very well laid-out. Thank you.
Sunny
Hi Ankur,
I am working on a Dot Net application, i am a learner in QTP. I found most of the examples in Descriptive programming for web base applications. But here i mentioned my problem “How to do scripting if application contains 3rd party controls” is a client server application.
I have to go into the grid and should enter the values. But the grid is not recognized by QTP then how can i code using DP the other rows in the grid.
Please help me in this. If any other information needed in the problem please tell me i will attach the same in the problem.
Awaiting your reply.
Hi Ankur
This is chandra sekhar
I am working on a dot net application, yes i am a learner in qtp,there will be a text area where the doc id is generated by the application,please let me know how to recognize that using qtp , i need that id for further processing of the application process
please let me know its urgent
Hi Ankur,
Great article….
Have one question regarding independent actions.
I have created three actions in one test (Action1, Action2, Action3).
Now when i run test i want after completion of “Action1” it should directly goto “Action3” and not executing “Action2” …
how do i do this…
kindly help.
How do you use QTP to test SOLR indexing data
what is the difference between Description.Createobject() and Description.Createobject and Createobject(“”)?
Hi Ankur…
exacellent job… really greate article.
Appriciate your information that u have given abt DP
Thanks alot…
Hi Ankur,
I have seen your posts on this blog and they are very helpful..
I have a problem, that is I need to get all the objects of an application into an excel sheet as how you get into your OR in QTP..
I should not any Object Repository in QTP and should use the Excel sheet where I got the objects as my OR..
I’ve succeded in getting the objects dynamically into an excel sheet.. But not finding a solution to write a script, basing this excel sheet as an Object Repository and those objects which are stored in that Excel..
Kindly help me out as it is a very hight priority issue..
Thanks
Vij
Hi Ankur
I am having a problem in QTP, I need to clear the Radio button selection with Descriptive programming in VB,
I have done this in WATIR and SELENIUM but in QTP its still a mystery for me.
Please guide me
Thanks
Ravinder Singroha
Hi Ankur.
I’m have problem with creating 1 run time object out of two.
For example:
I have webtable object that has 2 columns and 5 rows, so there are 10cells i.e. 10 odjects because each cell treated as single odject.
Is that possible to create 5 objects basing on principle that 1 row is one object?
If yes please describe.
Thanks,
George
Am working with Windows based application developed in VB
Is there is any spl thing needs to be done for a descriptive programming for windows application
There examples what had refered is related to webapplication
If am following the same whetherit will work
Hi Ankur,
This is AnanthaKrishnan.Your are doing an Excellent service. first of all ,i thank u very much for giving us such a fabulous article which really making me to understand easily and clearly.If ever any doubt in that,i write to u ,please help me with your reply
Hi Ankur,
It is really a good example to understand the descriptive programming but I am facing the problem to click on a WebElement which comes under multiple WebTables like Browser->Page->WebTable->Webtable->WebTable->WebTable->WebElement.
I want to click on the WebElement which is following the above hierarchy. So I will be very thankful if you will help me to get rid from this problem and provide me the solution.
If anybody have the solution apart from Ankur please help me.
~Sandeep
hi ankur,
whether it is possible to capture snapshot when run time error occurs using QTP 9.5……..
the snapshot should be in excel or pdf file,by using movie recorder it is capturing all the sanpshots but i want only runtime error
Hi ankur…
exacellent job… really gr8..article..
thanks alot…
Cleaner code for Gmail access using QTP for demo of descriptive programming
‘ Sign In. The application URL is set in Record Settings in QTP. Not using SysUtil
Browser(“Name:=Gmail: Email from Google”).Page(“Title:=Gmail: Email from Google”).WebEdit(“Name:=Email”).Set “ur e-mail”
Browser(“Name:=Gmail: Email from Google”).Page(“Title:=Gmail: Email from Google”).WebEdit(“Name:=Passwd”).SetSecure “ur password”
Browser(“Name:=Gmail: Email from Google”).Page(“Title:=Gmail: Email from Google”).WebButton(“Name:=Sign in”).Click
‘ The Frame object in Gmail ( IFRAME) comes with dynamic values each time we access the application.
We need to capture the IFRAME name for Sign Out and InBox links. The dynamic frame name is captured in x
Total there are 4 frames in GMAIL and the third frame contains Sign Out and InBox
Set obj_ChkDesc1=Description.Create()
obj_ChkDesc1(“html tag”).value =”IFRAME”
Set allFrames = Browser(“Name:=Gmail – Inbox.*”).Page(“Title:=Gmail – Inbox.*”).ChildObjects(obj_ChkDesc1)
x = allFrames(3).GetRoProperty(“name”)
‘ Click InBox
Browser(“Name:=Gmail – Inbox.*”).Page(“Title:=Gmail – Inbox.*”).Frame(“name:=” &x).Link(“text:=” &”InBox.*”).click
‘ Click Sign out
Browser(“Name:=Gmail – Inbox.*”).Page(“Title:=Gmail – Inbox.*”).Frame(“name:=” &x).Link(“text:=Sign out”).Click
Question to Ankur / Readers ( Please help )
Like whatever I did for Frame I captured the InBox link with actual unread mail.I used the following code but the code is not working.
Here y is Inbox(whatever number your mail is captured dynamically). But this code does not work at all.
y = InBox ( 76 ) – 76 is given for example but I captured the exact number of unread mails in my mailbox.
When I susbtitue here as i did for FRAME this does not work. That is why I used wild character above.
I chekced the frame name and for the given session the IFRAME name for InBOx and Sign Out is same.
Browser(“Name:=Gmail – Inbox.*”).Page(“Title:=Gmail – Inbox.*”).Frame(“name:=” &x).Link(“text:=” & y).click
QTP for GMail Example. Substitute user id and password with your gmail user id and password.
BEGIN QTP
Browser(“Name:=Gmail: Email from Google”).Page(“Title:=Gmail: Email from Google”).WebEdit(“Name:=Email”).Set “your e-mail”
Browser(“Name:=Gmail: Email from Google”).Page(“Title:=Gmail: Email from Google”).WebEdit(“Name:=Passwd”).SetSecure “your password”
Browser(“Name:=Gmail: Email from Google”).Page(“Title:=Gmail: Email from Google”).WebButton(“Name:=Sign in”).Click
Set obj_ChkDesc=Description.Create()
obj_ChkDesc(“html tag”).value =”A”
Set allLinks = Browser(“Name:=Gmail – Inbox.*”).Page(“Title:=Gmail – Inbox.*”).ChildObjects(obj_ChkDesc)
x= allLinks.count()
MsgBox x
‘Click SPAM mailbox in your GMAIL
MsgBox allLinks(34).GetRoProperty(“text”)
For i = 0 to x-1
‘MsgBox allLinks(i).GetRoProperty(“text”)
If UCase(Left( allLinks(i).GetROProperty(“text”), 5)) = “INBOX” Then
MsgBox “There are ” & Right(allLinks(i).GetROProperty(“text”), 4) & “mails in your InBox”
allLinks(34).click()
Exit For
End If
Next
‘Sign Out
allLinks(27).click()
END QTP
Hi all,
I am using QTP to test a java application. The software I am testing has lots of the same fields but with different labels (as per client requirements). I have added an object in the repository and updated it to use a regular expression instead of a static value. Shouldn’t this work? I am new with QTP and couldn’t find any advance book to search for a better solution. I am just not wondering to have to put all objects in the repository.
Thoughts anyone?
Thanks
Hi Ankur
Is it possible to write a vb script in descriptive programming and run the same using Vbscript editor,instead of QTP??
If so please let em know, how could we start of with
Rgds
Ravi
Hello All,
I am new to QTP and DP and would like to know if DP technique is better than OR ? From what I hear from my team is that
DP is useful only 1) when the application to be tested is in under construction mode but its interface design is available.
and 2) also, if using Mercury than… Mercury had the limitation of huge object repository till QTP 8.2 (They recommend the size to be limited to 1.5KB if you are using QTP8.2 or else you can see frequent crashes)…but for 9.0 and above there is no such limitation.
Any thoughts on above or when DP is useful ?
Thanks,
Mayank
I would like to check if Descriptive Programming is the means to rescue, if QTP fails to recognize objects in your web application. Can someone advise as to where you can find a compelte text for methods of Descriptive Programming ? I find a little bit here and there on the web.
Hi Ankur,
Thanks for your help on DP. However, I get stuck when the spy does not recognise an object on a window or in a frame. When recording it says some generic term. Properties window displays all blank. What properties should I use in this case?
Harish
Hi Ankur,will u plz explaing detally the concepts of Library files and Framework
Hi Ankur, I read your posts it is really helpful. Can you give an example in which scenarios(real application scenario) regular expressions r used and how it will be used small pseudo code?
Thanks
Waiting for your response!!
Hi Ankur, In my java application objects are recognised properly in OR. There are 4 radio buttions in the page. They’re getting recognised by OR but I can use only descriptive programming. I have used all the possible combinations of it’s properties to recognise the object but it doesn’t. All other objects get recognised with Descriptive method.
I’ve used “attached text”,”developer name”,”path” etc all the combinations but the object is not getting recognised. Could u pls help me resolve this issue. Or should I explore on using extern.declare method for the DLLs?
@NV:
How to regular expression works with descriptive programming in qtp 9.5 ?
Just as they work with other versions. There is no change.
VB script has performance penalty if it uses regular expression — is it true qpt scripts execution also decrease performance if descriptive programming is used?
ya the effect becomes pronounced when you have a lot of descriptive programming code in the script. For smaller scripts there is no minimal difference.
Hi Ankur, good article.
Have two questions i hope you have answer.
How to regular expression works with descriptive programming in qtp 9.5 ?
VB script has performance penalty if it uses regular expression — is it true qpt scripts execution also decrease performance if descriptive programming is used?
Thanks in advance,
NV
Hi Ankur,
Your blog regarding descriptive programming is very good and given me a good picture abt DP. Really I appreciate your job.
Thanks..
Hi Ankur,
i want to use DP for selecting a row in web table. can you please tell me how to do that? i need just hint. please help me out.
hai this is laxmi can you please give me the program for flight reservation application.i am working on vc i recorded some functions but i am doing the same with descriptive they are not functioning do you know why it is happening please help me.my email id lakshmi.jyoshna#gmail.com
Hi Ankur,
I must say this blog is very informative and I got to learn a few new things from it.
But, I guess this part of your code snippet doesn’t work…
For each desc in obj_ChkDesc
Name=desc.Name
Value=desc.Value
RE = desc.regularexpression
Next
It gives an error…
Object doesn’t support this property or method
The other method using a counter in the For loop works fine.
Hey Madddy,
Can you be more specific about the problem and what exactly are you trying to achieve. The earlier description is pretty vague.
MRR
Hi,
I am trying to automate the hierarchy tree in our web application.I am experiencing the problem in navigation.since each level is having unique property set.
I wish to automate the hierarchy navigation based on user input data..
Can any one help me out in this
Thanks in advance
Regards,
Madddy
hi Ankur
information providing u is very useful.thaks a lot.
i have a doubt.can we test content of a web page without using checkpoint.i mean using descriptive prgming.plz help me
Hi,
A great article for descriptive programming.
Please help me with a query regarding special characters in the value i.e.
obj_Desc(“html tag”).value= “INPUT”
obj_Desc(“name”).value= “txt.*”
If my obj_Desc(“name”).value contains parantheses ( or ) [for eg obj_Desc(“name”).value=”ABC(A)”] then code fails at the following step:
Browser(“Browser”).Page(“Page”).WebEdit(obj_Desc)
Any idea how to deal with it??
Thanks,
S
Hi Ankur,
I have 10 links in a webpage with same name “Continue”.
I want to randomly select one “Continue” link among those ten links.
I tried to retreive using Childobjects as follows..
=================================
Set oDesc = Description.Create()
oDesc(“Class Name”).Value = “Link”
oDesc(“name”).Value=”Continue”
oDesc(“innertext”).Value=”Continue”
Set Links = Browser(“B1”).Page(“B1”).ChildObjects(oDesc)
NumberOfLinks = Links.Count()
i=RandomNumber(1,10)
Links(i).Click
The above code is not working can you please suggest a solution for this.
Your help is appreciated
Hello Ankur Sir,
Can you solve my problem? Is it necessary to have a knowledge of VBScript for QTP testing? If we test the application through descripted programming,it reduce the time or consume the time?
Hi All,
Please use Testing Tools forum to post your QTP questions!
Hi
Is it possible to count number of objects in the web page and then tab through them using DP?
Hi Ankur
This is kiran.i want to know, how to connect to mysql from qtp.Can u plz give me code
regards
kiran
Hi Ankur,
This is truly a fantastic article.
You have explained your point with the simplest and best examples possible.
Thanks a lot for posting this.
Regards
Vikas
Hi Ankur,
I used QTP before on web application, now I am working on client/server vb .net application.
I am trying to get the row and col count of a table however qtp stops at this step and does not throw any error but its still in running state.
Code:
RowCou = SwfWindow(“frmMain”).SwfWindow(“frmLeadSearch”).SwfTable(“dgvLeads”).RowCount
None of the methods column count, get cell data are not working apart from DblClick row,col any row or col value clicks on the last row of the table.
Please do let me know how can I work with these tables.
Thanks
Hi,
We are using QTP 9.2 and are using OR instead of DP. The only issue that we are facing with QTP is that it is not very reliable at all times, and misses out on certain UI actions (say button clicks) intermittently. The same script will work fine on a box but will fail intermitently without any reason.
Do you reckon we switch to DP to resolve this issue. My personal view is that if i am using OR object with a set of properties, and using DP to define that object with same set of properties; then from reliability perspective, it will NOT make any difference; so this aspect remains same even if we use DP or OR
-Bipan
Hey Ankur,,
I hv just started to use QTP 9.2 and am facing some issues with testing frames. for some reason QTP is not recording the objects on a frame. It is showing the frame in Active Screen but it is completely blank.
Can you pls tell me about how to test frames and the objects in it..
Thanks heaps.
hi ankur,
in unit testing is there any function for alphabets checking like isnumeric for digits
plz tell me
bye
chitra..
Hi Ankur,
How to schedule a Test Batch Runner to run the script automatically without user intervention to press key F5?
or
How to scheduling to run the script automatically?
@ Amit:
Use “Property Name:= Property Value”
Eg:
VbWindow(“WindowName := MainForm”)
Recorded code for my VB-Based application is:
VbWindow(“MainForm”).VbWindow(“LoginForm”).VbEdit(“vbname := txtPassword” ).SetSecure “474baf160ffc7fe7494752fac902b5597a6bf9c7fe84”)
VbWindow(“MainForm”).VbWindow(“LoginForm”).VbButton(“OK”).Click
What will be the DP Code for this?
How to schedule a Test Batch Runner to run the script automatically without user intervention to press key F5?
give me one example for keyword driven testing,in dp
hi,
am working on web appl,after entering user by giving valid username and paaword,in that page only one weblist1 will open,which dynamic in nature,from this user will select required field,when the user selcting from welist1 corresponding account will appear in another weblist2.
which is my senario plz mail me how can we write in dp programme.
plz its very urgent
hi,
am new for QTP scripting plz give some suggetions to approchable guidence,how can we write and get solutions
thanks
r
I’m automating a web application .My web table accommodates upto 20 records. some times there may be a chance of having less also.how do i check it in QTP?
hi Ankur,
i would like write external function and want to use it in different places of My script.
My requirement is:
Application:Web Based
i’ve a web table in that multiple records are there. beside that i’ve buttons. Based on the records (single,Multiple consecutive, multiple non-consecutive)selection in the web table buttons property will get changed.In most of the pages i need to check this functionality.Could You help me in this regard?
Hi Ankur,
You r really helping so much for who wants learn more in qtp and thank you very much
Hi Ankur,
can we make DP using object spy
Achyut Aradhye
Using DP for all objects will slow down the script. But if OR is used for top level objects (eg. Browser and Page in case of Web application) and remaining in DP, the script will run faster than using just DP for all objects. I have several scripts which create objects on the fly and still run very fast
@ Sourav: A “micTab” statment will press the TAB key only for Windows, ActiveX and Visual Basic Edits.Now since your app is wab based you will have to create your own user defined custom function to do the job. I suggest go for clicking with mouse on the fields rather than tabbing. It will be good for maintenance of your scripts as well.
Thanks for the info regarding obj repository, will take note of it.
Regarding 2nd query Isn’t it possible for you to find the type of object at run time and then according to the type , do the required action ( using if radio_button then select() else if link then click())
Hey Ankur , also wanted to add one thing regarding repositary,
allthough there is no limit in QTP9.0 regarding size , but I have found that the moment the size exceeds 50MB , probability of it being crashed increases…
Again thans a lot for your promt answer for my query regarding clickin a web table cell….
Hey ankur thanks for the reply..for the first query ,
1> The application is web based.
for the second query
My question was not very clear:)
Actually the Child object type is not known.Wherevr the object type is known I have captured the text and created object at run time to operate on them. But in certain cases the object type is not fixed , e.g in cell(2,1) , the content might be a weblink or a radio button , but it is not predefined. I hope this time I am a bit clear.
@Ramesh:
It is not at all recommended to use DP…Use object repository wherever you can. With DP your test will take more time than object repository method.
HP-Mercury had the limitation of huge object repository till QTP 8.2( They recommend the size to be limited to 1.5KB if you are using QTP8.2 or else you can see frequent crashes)…but for 9.0 and above there is no such limitation.
@Anon:
1) Please tell me in which application you are facing the problem. is it web based/client-server/or any other?
2)for your second query follow this:
1. Get the number of columns and rows in the table. This can be done using the RowCount and ColumnCount methods.
2. Loop through the cells in the table.
3. Get the data value from the cell. This can be done using the GetCellData method.
4. If the data is the value you want, use the ChildItem method to get a reference to the object you wish to click.
Example: Browser().Page().Webtable().childitem(row_number,column_number,”Link”).click
5. Use the Click method to click on the data item.
For info on methods and properties you can refer.Help -> QuickTest Professional Help. Click “Object Model Reference”.
Hi Ankur,
Could you please help me out with a solution regarding
1> how to record “TAB” or “CTRL” i.e key board events.
2> if in a web table , in one of the cells there is a link then how to click it?? If we dont know before hand about the link text.
Hi,
Excellent article. cleared lot of doubts abt descriptive programming.
need one more info, is it recommended to completely eliminate the object repository and use descriptive programming. this will improve the performance (if object repository is huge) and by altering various properties one will be able to manage the objects ?
Thanks,
Ramesh Sharma
hi ankur,
i am really very happy with all the info. Ankur can u plz tell some thing about “Data table methods” and how can they be used.
Hi Dasari,
In simple terms a framework is a set of guidelines to accomplish a particular task.
In automation parlance you might have heard of data driven/key-word/hybrid framework. For details, you can refer to the “understanding framework” link alongside.
i feel very happy about descriptive programming!
but one thing i want u know, what is frame? i.e, test frame work, functional decomposition, keyword frame work, hybread ?
i don’t know the frame artichure and purpose of implementation
Hi Ankur,
Thank u 4 clear explain but didn’t menssion abt the string arguments for collect multiple objects and operate in application. In my application 100s of links are there, how to collect and test in application. Can you send me model script pls
Thank’s
RAjeshwar