How to know qtp object exists or not

By | July 23, 2009

How to know qtp object exists or not?

This post is very much useful for qtp beginner.
I am going to give step by step procedure to verify qtp object exists or not. So please go through simple following procedure and you will be able to verify object existence very easily.

1. Suppose you want to check that on http://google.com home page “Google Search” object is exist or not.

2. So after recording the test case (you have to click on “Google Search” object during recording) you will get one sentence like following.

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

3. Now in above sentence you have to remove click and write exist method to verify the object. So above sentence becomes like following,

If (Browser(“Google”).Page(“Google”).WebButton(“Google Search”).exist) then
Msgbox “object exists”
Else
Msgbox “object doesn’t exist”
End if

So Thus you can verify any qtp object exists or not easily. Let us know if you encounter any issue. You are always welcome to share your experience which will be helpful for our qtp learner friends.

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

9 thoughts on “How to know qtp object exists or not

  1. Anonymous

    I got an issue with this example, it is always return true regardless the object exists or not. Any method to get true if object exsits and false if object not exist?

    Reply
  2. Neelkanth

    Hi Friend,

    Please try GetRoProperty as a alternative option to check object exist or not.

    Let me know if you face any issue.

    Reply
  3. kcm

    GetROProperty(“visible”) is returning True eventhough the object is not visible.Please let me know any other solution

    Reply
  4. G V S Sunil Kumar

    object is not reecognizing by qtp when i put exist or getroproperty(“visible”)=”True” inside If statement when i removed IF Condition it is recognizing

    Reply

Leave a Reply

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