GetROProperty in QTP 9.2

Previous21222324252627282930Next

Let us assume that we want to return the Order Number of the order placed by using the first script we generated.

To view the script click First Script Insert Order in QTP 9.2.

What should we do then. QTP supplies an inbuilt method called GetROProperty and by using this method we can return the value.


GetROProperty (Get Run Time Object Property) in QTP 9.2

During Run Time a property of an object in the application is generating a value. We use GetROProperty method to fetch this property value and print it to the user.

To put it as a definition "GetROProperty is a method which returns the specified property value of an object during run time"

We want to print the order number to the user we will fetch the text value of the order number field. Look at the image below:


We use the Text property for the Order No Field. We will use the GetRoProperty method to get the text value and assign it to a variable which is an implicit declaration.

To the above script we will add a wait time of 8 second since the order has to be placed and the order number has to be generated. For this we will use the Wait function which waits for the seconds we mention.

The lines to be added are

Wait 8
Ord_Num = Window("Flight Reservation").WinEdit("Order No").GetRoProperty("text")
Msgbox "The Order Number is: " &Ord_Num

Run the script and see how the order number is printed.

Previous21222324252627282930Next

0 comments:

Post a Comment

/* Tynt Insight tracker ----------------------------------------------- */