Not stable object path to the "Programs and Features" window
Hello everyone,
In my test should be checked info about the installed app via the "Programs and Features" window.
I have identified the object path to this window by the "Object Spy" function of TestComplete.
Afterall I faced with next issue:
- If I have opened any projects in TestComplete, the object path to the "Programs and Features" window will be:
Sys.Process("explorer", 2).Form("Programs and Features")
- If I don't have any opened projects in TestComplete, the object path to the "Programs and Features" window will be:
Sys.Process("explorer", 2).Window("CabinetWClass", "Programs and Features", 1)
It reproduces on my PC: win10 x64, TestComplete 14.3 (I have reinstalled TestComplete v 14.4, but is still reproduced)
It doesn't reproduce on my colleague`s PC with the same basic config - win10 x64 + TestComplete 14.3
Will be appreciate for any info about this issue - how it could be fixed or at least why I am getting such behavior...
If you were using NameMapping, this could probably be resolved using something like a conditional mapping or some subset of properties that would identify the object as a stable object regardless of whether it is "Form" or "Window".
So, you could PROBABLY also find it using a FindChild or FindChildEx method to find the child object that matches a set of criteria.
Go to the Object browser and get us screenshots of the object in question. Please give the "Advanced" view of properties and include as many as possible. Also, if you can do that for both the "Form" and "Window" instances, that will help greatly. We can then assist with some logic to find the object.
My guess, in pseudo-code, is that it will look something like this. NOTE: THIS CODE IS NOT TESTED AND SHOULD NOT NECESSARILY BE USED AS IS.
var objectToFind objectToFind = Sys.Process("explorer", 2).FindChild(["ObjectType","ObjectID"],["Form","Programs And Features"]) if !objectToFind.Exists { objectToFind = Sys.Process("explorer", 2).FindChild(["ObjectType","Caption"],["Window","Programs And Feature"]) } if objectToFind.Exists { Log.Message("Found it") } else { Log.Message("Object Not Found") }