object properties in qtp

By | July 14, 2009

How to change object properties in qtp

Hi friends, today I am going to discuss on an interesting and important topic on object properties in qtp. I am going to give you practical example to modify object properties in qtp. So enjoy friends!!!

How to modify object properties in qtp

I have described here practical example in qtp. So please go through following steps one by one to understand practically it’s really interesting!!!

Please refer following recording and modifying the object properties procedure:

Procedure 1: Record and Run

1. Open QTP and start recording.
2. Go to start->run.
3. Write iexplore http://google.com
4. Right “quicklearnqtp” in search box.
5. Than click on “Google search” box.
6. Than close internet explorer window.
7. Run the script and verify it.

You will have script like following except that I have put “wait 5” sentence before last statement which will provide 5 second delay. Please do same in your script


SystemUtil.Run “iexplore”,”http://google.com”,””,””

Browser(“Google”).Page(“Google”).WebEdit(“q”).Set “quicklearnqtp”

Browser(“Google”).Page(“Google”).WebButton(“Google Search”).Click

wait 5



Please make sure that your script is running properly without any kind of error. If It works properly than you can go to procedure 2 otherwise correct it first.

Procedure 2: Modify object properties in qtp

1. In above script Go to third sentence in which object method is “Click”
2. Do right click on third sentence.
3. Change name of description properties from “Google Search” to “ I’m Feeling Lucky” refer following figure for more clarity.

4. Than click on “View in Repository” button.
5. Also Change name of object from from “Google Search” to “ I’m Feeling Lucky” refer following figure for more clarity.

6. Once you changed both object properties successfully, you will have script like following.


SystemUtil.Run “iexplore”,”http://google.com”,””,””

Browser(“Google”).Page(“Google”).WebEdit(“q”).Set “quicklearnqtp”

Browser(“Google”).Page(“Google”).WebButton(“I’m Feeling Lucky”).Click

wait 5



Now again run the script, now observe the interesting things this time. This time qtp will click on “I’m Feeling Lucky” button instead of “Google Search” and “quicklearnqtp.blogspot.com” will be opened instead of search result of google.

So thus you can modify your object properties in qtp. So you don’t need to record objects over and over.

QTP Tips: If you want to get properties of object in qtp use GetROproperty method and to set properties of object use SetTOproperty method. SetTOproperty method changes the properties of object during runtime so you can not see changed property in object repository. You can take QTP help for more details.

You are always welcome to share your thoughts or feedback to make this blog more practical and useful for QTP learners.

If you like this article, You can subscribe through mail.

One thought on “object properties in qtp

  1. krisdestruction

    thx the setTOproperty was very helpful in creating an array of objects


Leave a Reply

Your email address will not be published. Required fields are marked *