TestComplete adds number to WPF object
We have a WPF desktop app where some of the object names are having numbers added to them. For instance, when you record a test and create a CheckProperty test, it saves the objects name as:
hwndSource.MainWindow.Grid.AdornDecorator.PaneLayoutControl.PanePresenter.TestGridPaneView[x]
where [x] is a single digit numeric.
It has only happened with the Views that contain grids. In writing test scripts, I started noticing these different numbers being added. When trying to playback these scripts, they quite often fail because the grid object has a different number than what the script is calling for and the key tests also fail for this same reason. The thing is these objects should not have any number assigned to them. I'm assuming this is from "something" trying to disambiguate the names, but I'm not quite sure why it would do this, but not provide a mechanism to retrieve the name. If you look at the PanePresenter's Context or DataContext, this name doesn't appear anywhere.
It appears to be something added when the app is run and there is no mechanism in our code to come up with such names. Not sure if this is being done by the .Net runtime or by TestComplete.
Has anyone else ever heard of this issue and, more importantly, is there a way to get the name at runtime?
Thanks.
-Ron
Hi Ron,
I don't know if this is the same but i've had something like this.
Our view are generated dynatmically and can have more than one type open at the same time. As well diferent 'version' of teh view also exist and those also can exist multiple times on screen.
I dont know if this will fix your problem but replace the [x] number with *
other option if you are trying to locate the view via script codes, try using the Find() or FindChild() and use the property "ClrFullClassName"
parent.findChild("clrFullClassname","TheFullClassNameOfTheObject",depth)
also to becareful that if you have more than one object, both of these will return the first instance only.
there's also the parent.FindAllChildren("clrFullClassName","thefullclassname",depth)
and check if you have more than one using ubound() on the array
.. sorry these are vbscript codes