I am observing a strange thing with the Page.GetTOProperty method. Steps to reproduce:
Paste this script code:
Dim IndexPropVal IndexPropVal=Browser("Google").Page("Google").GetTOProperty ("index") Print "IndexPropVal=" & CSTr (IndexPropVal) & " IsEmpty=" & CStr (IsEmpty (IndexPropVal))
Run the script
Questions:
Why does it output the following?
IndexPropVal=20002 IsEmpty=False
In some cases it is 10002, in other cases 20002 or 30002, for which the reason is unknown.
Why doesn't it print this:
IndexPropVal= IsEmpty=true
which is what I would expect, as for all TO properties that are not defined in the OR, GetTOProperty should return empty?
The variations (10002 versus 20002 versus 30002) might depend upon whether the test object is in an object-based OR or not, and/or whether the script is a component or a GUI action script in some way, but this doesn't always seem to be the case.
It surely is independent of how often you run the script, or if you close UFT between runs.
It also does not matter if you turn on or off smart identification globally, or for each individual OR entry (i.e. the browser OR entry, and the page OR entry).
I cannot find any reproduceable dependency!
I observed that first in UFT 14.50.
I am sure that UFT 12.03 correctly used to report the Empty value if no index property was defined in the object repository.
What is going on?
Since there is always only one Page
object per Browser
object the index is meaningless, if the description is empty or fits there is one match and if the description doesn't match there are no matches. As index
is an ordinal selector, only used if multiple objects match a description, it is useless for Page
test objects.
UFT seems to be using the index
property for internal housekeeping, you shouldn't be using it and it shouldn't effect your tests.