Wednesday, October 16, 2013

QTP GetROproperty and GetTOproperty


QTP GetROproperty and GetTOproperty
 
To better understand the concept of GetROproperty and GetTOproperty methods practically we can follow below steps:
1.       Start recording on QTP.
2.       Open Google.com page
3.       Click on “Google Search” button.
4.       The script will looks like following,
 
SystemUtil.Run “http://google.com/”,”",”",”"
Browser(“Google”).Page(“Google”).WebButton(“Google Search”).Click
Browser(“Google”).Close
 5.       To use “GetROproperty” Now modify the second statement to following,
Msgbox Browser(“Google”).Page(“Google”).WebButton(“Google Search”).GetROproperty(“name”)
 6.       Now run the above script, You will get msgbox which contains “Google Search” in it.
 
GetROproperty: This property is used to get the property of the object during runtime from the UI. In our case GetROproperty gets property of “name” object of “Google Search” webbutton.
 7.       Now copy the above statement and modify it to following,
Msgbox Browser(“Google”).Page(“Google”).WebButton(“Google Search”).GetTOproperty(“name”)
 8.       Now close your browser and comment out other code except above statement.
 9.       Run only above  GetTOproperty statement. You will again get msgbox which contains “Google Search” in it.
 
GetTOproperty: This property is used to get the property of the object during runtime from the Object repository. In our case GetTOproperty gets property of “name” object of “Google Search” webbutton which is already stored in QTP object repository.
 
Now hope you are more clear regarding GetROproperty and GetTOproperty methods in QTP. You are always welcome to share your thoughts or doubts in QTP.
If you like this article, You can subscribe through mail.