QTP Object Exist or Not – GetROProperty

By | February 16, 2010
QTP object exist or not – GetROProperty method
Friends, After long time I am back with more QTP stuffs which will help you all to easy your QTP automation work. Today I am going to share some knowledge on verification of QTP object existence in detail.

As I already discussed in my post How to know qtp object exists or not, that how to verify that particular object present or not in web page. This post is very helpful for you because in some cases you can use this method as alternative to QTP checkpoints and these methods are more reliable compare to checkpoints for regression testing. In this post I had written about Object.exist() method. I observed that some times this method doesn’t give accurate output. Today I will talk about GetRoproperty method to verify object existence.

Let’s take one example with object.exist() method first, than will talk about GetRoProperty, Following example will check whether “Google Search” button on Google homepage is exist or not.

Following is the example with exist method,

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

Now same example with GetROProperty method,

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

You can also use above method in following way,

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

Thus, using Object.exist() and Object.GetRoProperty methods you can verify object existence easily.

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

Leave a Reply

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