Is there a way to search for a WPF control or window by its text
I can't identify my applications tooltips using the object browser, so I am wondering if there is a way that I can search the object browser for a text string matching the tooltip text to try and figure out how I can identify it in the future.
Is there a simple way to do this?
Hi,
> The code just creates a new tooltip object.
As per documentation (for example, https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/tooltip-overview) tooltip object must not just be created, but also associated with the target object. (Though I believe that this is done in the real application.)
I was not able to find yet if tooltip in WPF is a windowed or window-less object. If the latter, it should not be displayed in the Object Browser.
Anyway, I think that you should carefully investigate the target control (button, etc.) in the Object Browser and search for the property that contains tooltip text.
You may also talk one more time to developers and ask them how they assign tooltip to the control. I can imagine the scenario, when the control has, for example, OnMouseOver event handler and tooltip is set within this handler and removed by another handler when mouse leaves control's boundaries.
In this case you will need to know the name of the control's property that contains tooltip text and just refer to this property 'blindly' from test code. (Because, obviously, you will never see tooltip text for the control if the mouse does not hover it.)
Hi,
> TC could not at all recognize that that entity existed on the screen.
I think that this is the consequence of the incorrect implementation of tooltip (as per your words and referenced documentation) and is an implicit proof that Tooltip is a windowless object (like TLabel in Delphi).
Basically, TestComplete can recognize only those window objects of the tested application that are registered in the system during runtime. These are the objects that you can spy using, for example, Spy++ utility provided by Visual Studio. You may try and check if you can identify (incorrectly implemented) tooltip object using Spy++. If tooltip cannot be identified, this is one more reason to think that Tooltip is a windowless object.
In addition to the above, TestComplete implements additional logic to be able to identify additional objects that are visible on the screen but are not registered as window objects in the system. Obviously, to be able to do this, those objects must follow some rules and/or requirements.
To my opinion, the fact of instantiation of the tooltip object during runtime means nothing and cannot be processed by TestComplete if the instantiated tooltip is not tied to some UI control.
This is how I see it.