Same Type of Object Identification, Difference Amongst Same Type Of Objects With Example in QTP

Same Type of Object Identification, Difference Amongst Same Type Of Objects With Example in QTP

How to make QTP understand the difference amongst the  same type of objects .Suppose there are 5 check boxes in a page and I have to choose the 2nd one, how to do that through script?

Ordinal identifiers can be used like index along with the little descriptive programming for object identification.

Generally for common and same object we use Ordinal identifier:

This will depend on similar description objects which required Ordinal identifier. Mean if object A have and Object B have the same assistive and mandatory properties then only ordinal identifier can be used to identification for objects uniquely. This value will be related to the another screen of objects. So if there will be any changes on screen then this recognizer may not be useful.

This should be note out that when the assistive and mandatory properties will be enough then an ordinal identifier will not assign while recording. It can add later after on clicking the related column for the object.

Three 3 types of Ordinal Identifiers are available:

  1. Index → IT is generally base on the appearance order of any object inside the code of application
  2. Location → As it name suggested it based on the location from the screen or page or dialog box.
  3. Creation Time → This will be used for objects of browser. In the case of two browsers with similar objects having similar properties exist, The which one is created first that to next will be considered.

For an example → Let's check how the identifier 'Index' will work in login screen of Flight Reservation Application:

Following component are required:

Same Type of Object Identification
Same Type of Object Identification

Here you are able to see that the edit box and the static text have the same 'text' property.

See, If you know that one is the WinEdit Object and other is a static text, then there can not be a problem to you at all. But if both of them are treated as the WinObjects then it will create the difficulty and you will have to specify that which object required to act on. You will be required this only then when smart, assistive and mandatory identification will be failed. So in order to instruct the QTP we will have to use the Ordinal Identifier of QTP …

Ordinal Identifier
Ordinal Identifier

Now you will set the name of Agent with static text identifier as 0 and for edit box 1, will be set by you.

IT will look like the below image:

Difference Amongst  Same Type Of Objects
Difference Amongst  Same Type Of Objects

So if you required to access or authority the static text then you need to do as follows:

WinObject(“text:=Agent Name:”, index:=0) – This will point the static text
WinObject(“text:=Agent Name:”, index:=1) – This will point the Edit box

Now same theory will applies also on the identifier of location except that we shall select the location in the window to decided the numeric value that will be applicable to a certain object.

Virtual Objects with Example in QTP
Cross Platform Testing

What is Object Spy in QTP Ordinal Identifiers Alone can Make an Object Unique

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Posts