1
votes

Imagine creating a new QTP project. You hit record to get your first bit of code in place. By default, you'll get something like:

Browser("MyApp").Page("MyPage").WebEdit("MyLogin").Set "Bob"

And you'll get the Browser, Page, and WebEdit objects automatically added to the repository. What I would like to be able to do, as one of those QTP bods that prefers descriptive programming, is hit record, and get something like:

Browser("name:=MyApp").Page("name:=MyPage").WebEdit("name:=MyLogin").Set "Bob"

And have no objects added to the repository. Is there a setting / option to do this somewhere?

(Obviously there are arguments for not wanting to do this, which I acknowledge and appreciate - but for those of us that prefer DP, this could help expedite test creation).

1

1 Answers

2
votes

From what i understood is that you want to hit 'Record' button and you will get the script in descriptive type rather than the usual. But that is not possible.

For descriptive programming, you have to explicitly write the code by identifying the properties of each object for that (you can use Tools > Object Spy).

For above example:

  • Go to Object Spy > Select "the pointing hand symbol button" and click on the WebEdit for which you want to set the text "Bob"
  • Now, from Object Hierarchy select each object Top to Bottom and write properties of those object in the script. Like 1st Browser, then Page, then WebEdit. Try adding as more properties as you can.

You just can not get descriptive script by hitting Record button.