QTP – Descriptive Programming (DP) Concepts 1

Introduction

Descriptive programming has become the technique of choice for many QTP test developers. We can talk about its advantages and disadvantages all day, but here, we’ll only discuss the concepts and come up with our own idea of what it does better, and what it doesn’t :). This is going to be a very quick refresher before we move on to its everyday application by completing an end-to-end testcase.

The idea behind descriptive programming is for automation developers to instruct QTP which properties they would like to use to identify an object, instead of having QTP to choose them itself. If done correctly, this can help create robustness in scripts, ultimately requiring less maintenance-time and more development time.

Let’s begin.

But wait, before we really begin, we must understand QTP’s Object Spy. It is an inbuilt tool that enlists all of the test-object and runtime-object properties. These properties are different for different types for objects. For example, an image has a property called ‘file name’ whereas a listbox doesn’t. Instead, a listbox has a special ‘all items’ property whereas the image doesn’t. This discussion will be limited to the usage test-object properties to identify objects. Below are 2 snapshots of the Object Spy:

p>

Object Spy Icon

Object Spy Window

Now, let’s open www.Google.com and use the object spy to retrieve all properties of the search box:

Object Spy: WebEdit Properties

Notice the image above. The editbox has a HTML TAG property with its corresponding value ‘INPUT’. This means, the editbox takes some input from the user – which is true because we do set some value in it! It also has a ‘MAX LENGTH’ property, with a value of ‘2048’. This means, you can enter a maximum of 2048 characters in it (the best source to see all of the Test-Object properties of objects is the QTP help itself). Below you will see an editBox which can contain a maximum of 9 characters:

Test maxLength:

You can really use all these properties to identify this editbox, but, do we really need to use all of them? No. That is the most important idea behind descriptive programming – we only use what we need. Below is how we write descriptions for objects:

Above, ObjectClassName (in Web applications) can be Browser, Page, Frame, WebEdit, Image etc. Properties come from the left column the ObjectSpy column whereas values are in the right column. We can include as many properties as we want, but in reality, we only need to add a few to uniquely identify the object. Knowing which properties should suffice to uniquely identify can object will come from experience and practice. Below is a description I created for this editbox (WebEdit):

I already mentioned the HTML TAG and its value INPUT above. We’ve also added a new property/value here: ‘name:=q’. Is this enough to uniquely identify the object? Yes. But is it enough to make our script work? No, sadly its not.. and that is because, we haven’t yet created descriptions for its parent objects: Browser & Page. Below are the snapshots of the spied browser and page objects:

Object Spy: Browser Properties

Object Spy: Page Properties

Browser description

'ObjectClassName( "property1:=value1" )
Browser( "title:=Google" )

Page description

Page( "title:=Google" )

Now, we will connect all these descriptions and form a hierarchical tree:

You might wonder why I have omitted the WebTable below the Page and above the WebEdit object. In practice, we can also skip the Page object to identify the WebEdit. But, why did I skip the WebTable after all!? When you experiment more with DP, you will discover that some objects are embedded in many WebTables, and it will become cumbersome if we were to include all WebTables in the hierarchy to get to the object of interest (thanks to the person who thought that will be a terrible idea!). Example of the previously mentioned scenario:

Object Spy: Multiple WebTables

To complete the statement above, we will add an event. In QTP, events can be described as actions on target objects. For example, a WebEdit has a ‘Set’ event. we use the ‘Set’ method of a WebEdit to set a value:

Set is a QTP event to put in a value in the edit box. Different objects have different events. For example: an Image has a ‘Click’ event associated with it.

This, we did without using Object Repository. The same concept applies to all objects regardless of what your environment is. We perform actions on child objects by accessing their object hierarchies. Let’s complete the above example by searching for our keywords (use the spy again on the search button):

Perfectly explained my confusion about WebTables in web page and why we don’t include them in the code until they required. Thank you!!!

“You might wonder why I have omitted the WebTable below the Page and above the WebEdit object. In practice, we can also skip the Page object to identify the WebEdit. But, why did I skip the WebTable after all!? When you experiment more with DP, you will discover that some objects are embedded in many WebTables, and it will become cumbersome if we were to include all WebTables in the hierarchy to get to the object of interest (thanks to the person who thought that will be a terrible idea!). “

Hi Anshoo..
Is there a way to click on new tab in same browser without using opennewtab() function? Can you please help me on this/ I’m trying to wrote code to open new tab using below lines getting error
SystemUtil.Run “iexplore.exe”, “http://www.google.com”
Set myb = Browser(“name:=Google”)
Set mywo = myb.WinObject(“nativeclass:=client”)
Set myt = mywo.WinButton(“nativeclass:=push button”,”acc_name:=New Tab (Ctrl+T)”).Click

I need qtp script for the flight reservation window verify the business price is twice the economy class and also for open the flight reservation window verify the items present in the flight reservation window are alphabetically sorted.

Is there a way we can parametrize the object we are checking. What I mean is can we have a function where we could pass the Obj Class Name, there by having a single function to check different object types.
I tried doing that but its not working.

(1) Is it good to add the ‘Web tables’ that you omitted?
whats the best practise?

(2) When we spy using the ‘Object spy’, lot of ‘properties’ are shown.
Among these properties of an object, how do we conclude that ‘specific set’ of properties can be used for Descriptive programming?

Lakshmanan: It depends. At times, it may be required to reference a ‘static’ table to reach to a ‘dynamic’ element. Other times, it may not be required. The best practice then is to make sure your script is robust, with or without the table :)

To select the properties from the Spy, again, it depends. It comes from experience and knowledge of HTML/CSS/DOM. There are no set rules as static properties change from one object and technology to another.

Hi,
i am working on qtp. i am calling a function in my script . i have the defined objects used in my function in my script using DP.
When i call that function i am getting the unknown error .
But when define my objects inside the function and call that function in my script its working fine.

Please can any one help me whats the problem with first case because i want to reuse that function in my other script.

Hi Anshoo,
In QTP10.0 I don’t see any runtime and test object property radio button on object spy while I see native and identification property there,so how this GUI change is related to old GUI
is native property(10.0) updated from———>runtime(old GUI)
and identification(10.0) updated from———->test object(old GUI)
please help me out on this.
thanks,
Piyush kotiyal

I felt very elated going through the contents and the quality of deliveries for the queries over here.Thanks for being so cooperative.

I was looking around for a issue using QTP DP. Is there any way to verify if a web-based application can be verified for refreshing a screen.
The actual thing to verify is if i select an item from a drop down menu, the screen refreshes.

Chandan it may be possible. Retrieve the sourceIndex of any object on the screen, refresh it, retrieve the sourceIndex again and see if it has changed.

sourceIndex = Browser("title:=Google").WebEdit("name:=q").Object.sourceIndex
Browser("title:=Google").Refresh
Browser("title:=Google").Sync
If sourceIndex Browser("title:=Google").WebEdit("name:=q").Object.sourceIndex Then
MsgBox "The browser was refreshed!"
End If

hi,
the process which you have explained above is very good and understandable for web applications but when we work with windows application how can we get the DP of the menu objects in flight reservation window can you please explain i detailed

The “[ Link ]” object’s description matches more than one of the objects currently displayed in your application. Add additional properties to the object description in order to uniquely identify the object.

Hi! Anshoo
I was working on QTP using DP. I used the above URL to login to the application. That part worked well but after login I go to next page and create contact and that is not recognized by QTP. Can you please please help me. Here is the script I wrote:
browser(“name:=opentaps CRM”).page(“title:=opentaps CRM”).webedit(“name:=USERNAME”,”index:=0″).set datatable.value(“Username”,”dtLogin”)
browser(“name:=opentaps CRM”).page(“title:=opentaps CRM”).webedit(“name:=Password”).Set datatable.Value(“Password”,”dtLogin”)
browser(“name:=opentaps CRM”).page(“title:=opentaps CRM”).webbutton(“name:=Login”).Click
wait(20)

Hi,
I want to know to perfrom scripting in MACro Excel,i have a excel tool which add a addins afetr opening the Excel file and after clickin on the addins i got a list of option in the Listview and when i click on any option it open a form and in that form we have a drop down and a username and password filed like that.
Can you please tell me wat type of scripting we have to use.

LogOut is an image for English website. Quitter for French. Technically, is there any difference between the two? Will QTP find Quitter first or LogOut first, for the first line? Does it reads and finds properties(values) from Left to Right or Right to Left?

***If I want to highlight this image for any of the French or English sites, I would prefer it to be highlighted in one line only. Do you have any inputs for this to make that happen?

English–> file name:=button_logout.gif
French–> file name:=button_logout_fr.gif
(This is how our developers have put the values….Assume, there’s no such property which has the same value for the image)

1st I dint check as it will work fine for sure.
Browser(“name:=.*”).Page(“name:=.*”).Image(“alt:=LogOut|Quitter”).Highlight
This is also absolutely working fine. Thanks very much for telling. I’m glad now :)

And…(I find, it finds from Right to Left till the object gets uniquely identified)….take care

/*When you experiment more with DP, you will discover that some objects are embedded in many WebTables, and it will become cumbersome if we were to include all WebTables in the hierarchy to get to the object of interest (thanks to the person who thought that will be a terrible idea!). */

Thanks a lot, Anshoo.
I am novice to QTP .
I was cracking my head using Webtables because the object of my interest is embedded under various webtables as similar to the example.I gave all the properties for the webtable. But i got an error stating that QTP could not identify it .I did not reallise the fact that we don’t need to follow the hierarchy strictly.With your concept,I understood that there is no need to give as per the hierarchy (except in the case of ChildObjects to retrieve an object collection, as you have told for one reader’s reply).I removed them and i am able to do a click on t he object.

Rajni, you may have to use Index to identify the second one. Plus, you can read the article I mentioned in my previous post.. It explains how DP can be used to create descriptions at run time, which is what your scenario looks like.

Hi Anshoo,
Great explanation. your examples are very easy to understand.I am working in QTP for the first time.
I read your articles on Descriptive Programming.(DP Concepts 1).Really nice work.
I ‘ll describe you the scenario.Kindly help me in doing the same.
1) There is a weblist from which i have to Select No of claims eg.One claim/Two claim/Three Claim
2) Depending on the Selection,the WebEdit boxes and Weblists get populated i.e.If i select One claim,One webedit and one weblist gets populated(two more webedits/weblists)
The issue is that as all the objects(WebEdits and Weblists) have diffrent names,I have to code for all of them seperately.Is there any other approach(DP/anyother) that i can follow so that I need to write less code.
Please help.I shall be very thankful

Currently, I am facing a problem with my QTP script. I am using systemutil.Run method to open ie and run my web application. But, the problem is when I need to do some volume test, I am using data table. Now, when the second row of the data table is executing, due to the systemutil.Run, another browser is opening and am getting a run error. I need a solution to recover my script from this general run error.

If Environment.Value("ActionIteration") = 1 Then
SystemUtil.Run "", ""
End If

But the above is going to be a little tricky if your test does not always start with the first iteration. For that, you may be required to store the action iteration in a variable and use that variable in your test:

I have installed QTP 9.2 on windows 7. But, QTP is not able to recognise IE as a web browser. It is showing it as a win object. The problem is same with even QTP 10.0 (trial version). Do u have any solution for this?? I even tried by registering the browser in QTP.

If you open the Object Spy and for a WebElement object, if you notice the supported Operations, you will find that it does not support the Set event. Also, when building object hierarchies, you must always specify the Test Object. Either that, or replace the Test Object with an object collection of the same class.

Great explanation. your examples are very easy to understand. I am beginner with QTP and refer your blog for reference.
I need your help for the following.
Var1=Browser(” “).Page(” “).WebList(” “).Select (DataTable(“Desc”, dtGlobalSheet))
msgbox Var1

I have parameterised value and trying to retrieve its value using a variable and display same using message box. But cannot.
How do i do this. Cos for further validation i need the value from table.

Actually i also tried with the following method. Let me know if it is correct?
Browser(“”).Page(“”).WebList(“”).Select DataTable(“Desc”, dtGlobalSheet)
Var1 = Datatable.Value(“Desc”, dtGlobalSheet)
MsgBox Var1

Technically, if no error occurs, it will always work. However, if the value from the DataTable is invalid, it will certainly result in a run error. When that happens, Var1 will denote the value that *was selected*, when in reality, it was not..

I had recorded a script using default Flight Reservation sample second’s page.
Parameterised FromMonth and FromDay drop down. Now when running the script it is not going for 2nd iteration since click on Continue button at the end lands on next page. so not coming back to previous page.

How should i run all the iteration.

Note: Have started recording directly from second page so there is not login.

Hey Anshoo,
That was really a very silly question which i asked you. Sorry to bother. I should have recorded one more step at the end to return to same screen again to continue all my iterations.
Radhika

You must include the code to navigate back to the Parametrized page. Please read this article: it shows how a parametrized scenario is a cyclic process beginning from Page 1 and returning back to Page 1 for the next scenario to execute.

Can you Please explain how to write script to check the default value for drop down, radio button, etc. Do we need to insert checkpoint or is there any other way.
For eg: Drop down “Passengers” is having default value “1”
Drop down “Departing from” is having default value “Acapulco”

You have the correct idea, and after sharpening a few corners, you will be able to create great scripts!! Please see my feedback to your code above:

Dim fromPort
'As the page loads, execute these statements:
If Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromPort").Check(CheckPoint("fromPort")) Then
fromPort = Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromPort").GetROProperty("value")
End If
'Place this code where the CheckPoint is to be performed
If fromPort <> "" Then
If fromPort = "Acapulco" Then
Reporter.ReportEvent micPass, "Default Drop down", "Departing from default drop down value is valid"
Else
Reporter.ReportEvent micFail, "Default Drop down", "Departing from default drop down value is invalid"
End If
Else
Reporter.ReportEvent "fromPort", "Value was not retrieved. Critical Error!"
End If

Can you please help me to understand below script with an example? It is actually checking whether elements in a Weblist are in Alphabetical Order or not.

arrCtry=Split(Browser("name:=QTP").Page("title:=QTP").WebList("name:=select1").GetROProperty("all items"),";")
Set objArray=DotNetFactory.CreateInstance("System.Collections.ArrayList","")
For i=0 to Ubound(arrCtry)
If arrCtry(i)"--Choose One--" Then
objArray.Add(arrCtry(i))
End If
Next
objArray.Sort()
objArray.Insert 0,"--Choose One--"
For j=0 to Ubound(arrCtry)
strOuput=strOuput+objArray(j)
strOuput=strOuput+";"
Next
If strOuput=Browser("name:=QTP").Page("title:=QTP").WebList("name:=select1").GetROProperty("all items")+";" Then
Msgbox "The Weblist's values are sorted in alphabetical order"
Else
Msgbox "The Weblist's values are not sorted in alphabetical order"
End If

'There are 2 parts to the below statement:
'1: Retrieve the 'all items' property of the list: it contains all items that are visible in the ListBox
'2: Split above statement with the delimiter ;
arrCtry=Split(Browser("name:=QTP").Page("title:=QTP").WebList("name:=select1").GetROProperty("all items"),";")
'System.Collections.ArrayList Class: http://technet.microsoft.com/en-us/magazine/2007.01.heyscriptingguy.aspx
Set objArray=DotNetFactory.CreateInstance("System.Collections.ArrayList","")
'Looping the array created in 'arrCtry'
'If there is a match found, add the object in the ArrayList Class(objArray)
For i=0 to Ubound(arrCtry)
'If a match is found:
If arrCtry(i) = "--Choose One--" Then
'Adding the object here:
objArray.Add(arrCtry(i))
End If
Next
'Sort the ArrayList in ascending order
objArray.Sort()
'Insert a new value at the very first position
objArray.Insert 0,"--Choose One--"
'Execute another loop and create a single string of values: strOutput
'strOutput = "--Choose One--;Match1;Match2" etc.
For j=0 to Ubound(arrCtry)
strOuput=strOuput+objArray(j)
strOuput=strOuput+";"
Next
'If the 'all items' property of the WebList matches the Sort operation above, then its a sorted list
If strOuput=Browser("name:=QTP").Page("title:=QTP").WebList("name:=select1").GetROProperty("all items")+";" Then
Msgbox "The Weblist's values are sorted in alphabetical order"
Else
Msgbox "The Weblist's values are not sorted in alphabetical order"
End If

Thanks for the explanation. It helped to understand.
But am still wrong output when run the above script. It is giving “not in alphabetical order”
Below is the code.
Set objarray=Dotnetfactory.CreateInstance(“System.Collections.ArrayList”,””)
For i=0 to ubound(arr)
If arr(i)”Acapulco” Then
objarray.add(arr(i))
End If

Next
objarray.sort()
objarray.insert 0, “Acapulco”

For j=0 to ubound(arr)
stroutput=stroutput+objarray(j)
stroutput=stroutput+”;”
Next

Dim arrArray, oArrayList, sElement
'Create an array with elements in Ascending Order
arrArray = Split(Browser("title:=Find a Flight.*").WebList("name:=fromPort").GetROProperty("all items"), ";")
Set oArrayList = CreateObject("System.Collections.ArrayList")
For Each sElement in arrArray
If IsNumeric(sElement) Then
oArrayList.Add CInt(sElement)
Else
oArrayList.Add sElement
End If
Next
'Sort Ascending
oArrayList.Sort
'Verify all elements in the Ascending array with the sorted oArrayList
For x = LBound(arrArray) to UBound(arrArray)
'If the array element does not match the sorted element, then the original
'array is not in ascending order
If Not arrArray(x) = oArrayList(x) Then
MsgBox "Not Ascending"
Exit For
End If
Next

It will only throw a MessageBox if the list is not in ascending order.

I try doing a wildcard by indicating “CN=.*”, but that didn’t work, how can I do a wildcard on this selection statement CN is equal to the machine name so there will be different machine that wil added to so the name will change. Thanks

I ve small query. ” I ve generated one test script and when i copy the intire folder of this QTP script( must be along with repositories) for same test in different machine.it is throwing error.what can be the reason? pls specify

First of all, I would like to thank and appreciate for coming up with such a nice Knowledge Resource on QTP. Great piece of work, indeed…!! I consider myself as a beginner in QTP and I am trying to learn the concept of Descriptive Programing. I found your website, read the articles and could not stop writing to you.
The way you present things and describe them is really very neat and clear, and impressive too. I found your site very different from others as I went through many QTP sites and blogs and know what they have. Sometimes, your comments and replies are much valuable than your articles….. :) That’s really nice. Now, I know I am in right place. So, I will start firing questions to you. I am sure you would address them with the same spirit, enthusiasm and patience.
Last but not the least, thanks for guiding beginner like me. All the best…….!!

The Issue is Few Cells in Table are Webelements, When Double clicked, will become WebEdits, where I set the values or Edit the Values depending on test requirements. now th issue is when i use the Above DOM Concept will resolve the problem of clicking the Row and column in table, however this Dom doesnot support the Set or Type the values to those cells.

I am New to the DOM concepts, if you can guide me to study material, i would really Appreciate the time and Effort.

again I’m having a question. I want to set global variables I’m using for several QTP-actions, such as
Set Google = Browser(“name:=Google”).Window(“text:=Google”)
Now I can only use this within the same action. How can I do this, will I need to define a public class I’m calling in each action?

great site and very accurately written topics and answers on questions!

Can you please help me on something… I’m trying to work out how to refer to a webelement in a webtable by DP and a parameter as innerhtml. Maybe you have already described how to do this, but I couldn’t find it here (if so post a link, please).

I want to use something as […] .WebElement(“innertext:=ObjectText”).Exist
while ObjectText is used as a parameter which I have already defined. This should be very simple to do if only I knew how to… I prefer to reference the cell text than to use an index because the text can be anywhere in the table.

Sorry, in the example Is used I mean innertext of course, not innerhtml. In my case, innerhtml and innertext are the same anyway. This is meant as a very general question, the same problem could be a reference to a website by parameter or something else.

I am the beginer of QTP I want to learn Regular Expression conpet and Parameterization concept in QTP.
What is the use of both things can u explain the things with good real time example.I need those things please help me on this.

Please see my other comment here about Regular Expressions. I am currently working on an article on Parameterization, and hopefully I will try to have it released soon.

In the meantime, to give you a brief overview, Parameterization is a technique in which you replace an actual value or an entity with a variable. That variable in turn, retrieves values from a data-pool and uses those values to drive the automation. For example, consider the following statement:

See this website :–> http://in.buzz.yahoo.com/ In this website, you will see a Yahoo logo image at the top. I am not able to click this logo using descriptive Programming though I am able to do so with the help of Object Repository. I tried various combinations but nothing worked. I am using QTP 9.2 with IE 7.

Hi Anshoo,
In search of Recovery Scenario i have gone through many forums and blogs but could only find the all-known pop up error handling.And also i found all the forums and blogs have almost same topics and examples about the QTP.
If you can provide video tutorials,with real time issues, that will be a great help for the visitors.Thanks for the reply!
I haven’t tried it yet but will let you know the outcome once done.

The reason why i said so is that we never had a situation other than handling the pop-ups.Let me assume that IE crashes while performing a DD testing.Suppose IE crashes at TestIteration no 50 and still 40 to finish.Will the script execute from 51 or 1? How to overcome such issues?
And also as we are unsure where exactly this might occur,we need to instruct the QuickTest to check on every line in the script for recovery which degrades the Tool performance.Doesn’t it?
I am elaborating this topic so that i can get a clear idea about recovery scenario. Thanks for the reply.

I appreciate your interest in learning more, and making your concepts clear.

Will the script execute from 51 or 1? How to overcome such issues?

In such a case, you have the following 6 possible steps to choose from:

Repeat current step and continue

Proceed to next step

Proceed to next action or component iteration

Proceed to next test iteration

Restart current test run

Stop the test run

In other words, you can choose any of the 6 possible choices above. If you would like to exit, then you can do that as well.

we need to instruct the QuickTest to check on every line in the script for recovery which degrades the Tool performance.Doesn’t it?

Technically, we don’t instruct QTP how to use the Recovery Scenario, we just tell it what should trigger it. QTP finds if an application state matches with what we have in our scenario and activates the trigger.

As for performance, it may impact it, but by only a little, I hope. They’re triggered only when QuickTest encounters a particular application behavior. You may be correct in saying that QTP may check after each executed line whether to trigger the Recover Scenario or not. However, I’m not too sure about this. Possibly someone at HP can answer this for us.

I am elaborating this topic so that i can get a clear idea about recovery scenario.

That’s great, Kiran. I feel I should learn more about Recovery Scenarios myself. Clearly, my knowledge on this subject is not vast enough to answer your questions accurately. This is going to be an action item, then!

Greetings !
I appreciate the work being done by you for the QuickTest newbie’s.Anshoo,as a member of AdvancedQTP forum, your solutions for the queries are very simple and easily understandable even for the newcomers. Great Job!
Please make me clear with the Recovery Scenario.
As every tester wants the script to be continued after particular recovery event has been handled then why don’t they use “If then else” instead of a calling a .vbs or instead of using a recovery manager.
When ,How and Where should i use recovery scenario.

When using Conditional Statements, you know that might happen here, and create conditions to tackle expected behavior of the application. For example, you may create the following Conditional Statement:

If Browser("").Page("").WebEdit("").Exist(0) Then
Reporter.ReportEvent micPass, "WebEdit", "The WebEdit was found!"
Else
Reporter.ReportEvent micFail, "WebEdit", "The WebEdit was not found!"
End If

Above, you know that there can be only 2 conditions for the WebEdit – that it exists, or it does not.

The same cannot be said when using Recovery Scenario. The reason why they’re called Recovery Scenarios is that, they help us Recover from something we do not expect. For example, you’re running a script and IE crashes. What do you do now? If you have a Click event right after IE shuts, QTP will throw a run-time error and your script will stop. This is where you may want to use a Recovery Scenario because you’re trying to handle an error that you would not normally expect.

The above example may be an extreme case, but I hope it clarifies the main difference between the two. One is where you expect what might happen, whereas, the other helps you overcome an issue that you would not normally expect to occur during run-time.

I hope this helps. If you’re still unclear, or have another question after reading my reply above, please feel free to ask! :)

Hi Anshoo,
Your knowledge and the way , you explained the things, just great. really really fantastic…
There are so many sites and blogs , explaining all these kind of QTP stuffs, but your’s I found different.

.. and to be honest with you, its one that’s quite hard to answer. Performance wise, there is a negligible difference between the 2 techniques. Usage wise, they both work quite well and are equally readable. That is, the reader can always make out what the script is doing between both methods.

Therefore, in the end, it bottles down to personal preference. I use the 2nd one in your post 90% of the time, and I have not yet come across a situation when it failed to work. But, please note that when you are using ChildObjects to retrieve an object collection, you must specify the complete hierarchy:

Set colLinks = Browser( "" ).Page( "" ).ChildObjects(oLink)

Other than that, I guess its just a personal preference. If you browse other QTP sites/forums, you will see the first approach used the most. I know this answer isn’t satisfying, but I hope you will be able to choose one that you would like to use extensively. :)

If your test contains both Shared and Local Object Repositories, then:

1. Your Local Repositories will be transferred to the local repository of each action in the test, as mentioned in the first bullet point.
2. Your Shared Repositories will be associated with the same test, but since you also have Local Repositories, in your case, your Local Repositories won’t be empty. They will contain information from #1 above.

You seems to be another expert in the field of QTP and I am deeply impressed by your posts which truly represents your vast experience along with your expertise. I have a question for your that may sound silly to you( as I am a QTP beginner). Still m taking courage to ask: I read in the QTP help file that :

###########################################################
Note for users of previous QuickTest versions: When you open a test that
was created using a version of QuickTest earlier than version 9.1, you are
asked whether you want to convert it or view it in read-only format.
Whether you choose to open it in read-only format or convert it, the object
repositories are associated to the test as follows:
➤ If the test previously used per-action repositories, the objects in each
per-action repository are transferred to the local object repository of each
action in the test.
➤ If the test previously used a shared object repository, the same shared
object repository is associated with each of the actions in the test, and
the local object repository is empty.
#############################################################

I have a doubt in the second point. What if my test created in a previous version (say QTP 9.0 ) contains both Local and Shared OR. So as per the second point will be Local OR will get deleted as it is saying the local OR is empty??

Hi, this is really a great initiative. I came across this and liked it very much. I am new to QTP and started looking in DP.
While implementing above code I came across two things.
1. For WebEdit class, if I use this: WebEdit( “name:=q,”html tag:=INPUT” ), I get an error, parentesis is not allowed while calling sub.
2. When I removed name:=q and check the syntax, syntax is valid but when I run the script, I get error.
( General run error).
This is what i am trying
Browser(“title:=Google”)
Page(“title:=Google”)
WebEdit( “html tag:=INPUT” )
Browser(“title:=Google”).Page(“title:=Google”).WebEdit( “html tag:=INPUT” ).Set “DP”
Browser(“title:=Google”).Page(“title:=Google”).WebButton(“name:=Google Search”).Click