3

I created a simple form with html that had two objects (Edit Box - first name) with same properties (like name, Input, and others) one below other. And I recorded a action in the one of the edit boxes and object got added in Local object repository, with Index as '0'(because of its order in source code).

I then modified the value of Index as '1' so that the same object would refer to second edit box with same properties but it doesn't happens in QTP.

Once ordinal Identifier is added and though we modify it in object repository and it does gets updated in repository and we could view the same. But it doesn't act like it when modified, i.e. in this case when we run the script it should refer to second 'first name edit box' but it doesn't happen so, why?

To brief my question Ordinal Identifiers once modified in Object Repository doesn't get really updated even though it shows like updated, why?

dmcgill50
  • 528
  • 6
  • 26
user1925406
  • 713
  • 3
  • 15
  • 33

1 Answers1

2

There is a web specific optimization in QTP which you seem to have run into. In addition to the regular description QTP stores the sourceIndex as a hidden property. Then when trying to identify the object it will first check if the HTML object with the stored sourceIndex matches the description, if it does it assumes that it's the correct object and doesn't search the whole DOM.

Since the ordinal (index in this case) is a special property that is used for identification only if multiple objects match, the sourceIndex optimization circumvents usage of the index.

In later versions of QTP (from 11 I think) QTP also stores a generated XPath to the object which has similar functionality. You can disable these optimizations in Tools → Options → Web → Advanced

screen shot of options

Motti
  • 110,860
  • 49
  • 189
  • 262
  • Do/did these options default to ON -- ever? – TheBlastOne May 15 '13 at 21:23
  • @TheBlastOne, AFAIK they default to ON -- always. – Motti May 16 '13 at 06:25
  • 1
    This question is a good example why "Run using source index" should default to OFF. If it doesn't function properly in all cases, it is not an optimization, but an optimization with negative side-effects, which we call a BUG :( and they are very, very hard to find. – TheBlastOne May 16 '13 at 07:00