Thursday, August 2, 2012

Why GetROproperty,GetTOProperties and SetTOProperty

*************************************************************************
GetRoProperty:
*************************************************************************
    To get  the Runtime object propertie values

Example:

'In flght reservation application while inserting order,Order Number will get generated at runtime
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "QTP User"
Window("Flight Reservation").WinButton("Insert Order").Click
Wait 4
vOrderNumber = Window("Flight Reservation").WinEdit("Order No:").GetRoProperty("value")
 *************************************************************************
GetTOProperties :
*************************************************************************

                   We can get the property values of test objects,i.e For QTP which properties are helpful to identify the object 

Example:

  
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "QTP User"

msgbox Window("Flight Reservation").WinEdit("Name:").GetTOProperties ("name")
*************************************************************************

SetTOProperty:
*************************************************************************

             We can Modify the object property values at run time

Example:

r.Activate

Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly From:").SetTOProperty “attached text”, “Fly To:”
Window("Flight Reservation").WinComboBox("Fly From:").Select "Los Angeles"


Note:Here we don't need to add FlyTo object to OR











No comments:

Post a Comment