At times, in tested applications, there crop up controls elements that are unknown in TestComplete and therefore, are unworkable; although, externally, a controls element of the kind appears to be a standard one (for example, a text field or a list of elements). It happens because programmers create controls with custom names and TestComplete doesn't know how to work with them.
The simplest way to resolve this issue is to try to explain this to TestComplete: this class is in reality a standard one (to be more exact, has been inherited from its standard class). In such a situation, we would be working with such an element as if it were a standard one, meaning the one taken after by inheritance. Certainly, in this case, we cannot use the extended possibilities of the controls element in view, while at least, we could execute some standard actions with it. For this purpose, TestComplete has specific project settings, which are called Object Mapping.
Since creation of a similar controls element or search for existing application to a similar effect is quite a difficult task indeed, we are using a workaround: teaching TestComplete not to work with the standard controls elements in order to obtain the data from a controls element of an entirely different type.
In Calculator Plus application (as in the standard Windows calculator), the controls element of the SysLink
class is being used. This element is visible if the menu item About is selected from the Help tab. The text this product is licensed under… is the element we are talking about. If one were to look up its properties in Object Browser, the wText
property would stand out as containing the text and the parameters, Link
and LinkCount
, allowing for more information about the links within the element. This element is our "guinea pig".
First we need to remove the existing object mapping for the SysLink
elements as follows:
SysLink
controls elements.In order to be able to recognize the SysLink
elements as text fields we need to perform the following steps:
SysLink
type inside the About window (this element is unique therein).SysLink
class, as shown in the following screenshot:wText
property available, from which we could get a hold on the readable text, as shown in the following screenshot:Usage of the Object Mapping is the simplest method to work with nonstandard controls elements in case they are inherited from the standard ones.
Usually, in the inherited controls elements, some standard methods and properties still remain, which can be resorted to in order to obtain all (or almost all) the necessary information. This is exactly what we have done in the example of the SysLink
element: we have taught TestComplete to work with this element as with a text field.
In truth we are bereft of some of the possibilities that the former properties held (for example, in the previous-mentioned example, we are short of accessing the Link
and LinkCount
properties); nonetheless, quite often all of what's within reach is enough for creation of genuine test scripts.
If Mapping has not been a real help, and you are still up against an unwieldy controls element, you will have to come up with some more advanced methodology, such as:
For more advanced ways of working with nonstandard controls refer the following recipes:
3.145.9.148