Forum Discussion

Andrii's avatar
Andrii
New Contributor
7 years ago

Cannot access ToolTip property using Object Spy (WPF)

Hi,

 

I'm interested in two cases: when ToolTip is Text and when ToolTip is an object. Neither works for me.

In both cases Object Spy shows (Null Object) (don't remember the exact text). However, Snoop shows them (please see the screenshot 'test.png').

It seems like Object Spy is not able to dig into visual tree properly.

 

I also tried to access the tooltip manually using WPFObject but it shows the same result:

....WPFObject("Border", "", 1).WPFObject("Grid", "", 1).WPFObject("ItemsControl", "", 1).WPFObject("ContentPresenter", "", 1).WPFObject("DisplayGrid").WPFObject("LeftSideTogglePopup").WPFObject("PART_ToggleButton", "").ToolTip

 

WPFObject("Border", "", 1).WPFObject("Grid", "", 1).WPFObject("ItemsControl", "", 1).WPFObject("ContentPresenter", "", 1).WPFObject("DisplayGrid").WPFObject("LeftSideTogglePopup").WPFObject("ToggleButton", "", 1).ToolTip

 

1) How can I solve this issue?

2) Is it possible to find a control by x:Name in the visual tree?

 

This limits our team in testing dynamically set tooltips. 

 

Thanks,

Andrii

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    It depends upon the implementation, really. 

     

    In some cases, "tooltip" is a property on an object.  In these cases, you cannot spy with object spy because there is no object to spy.  You spy the parent object and then access the tooltip property.

     

    For a web application I'm currently testing, there are these "hover" tool tips that open an object on the page for viewing.  These objects are part of the page but are only set to "visible" when the mouse hovers over them.  In these cases, we have to use the SHIFT-A method of capturing the item or go searching in the Object browser.

     

    So... guess it comes down to how your tool tip is implemented in your application.  Can you see it in the object browser (this is not the object spy, but the object browser tab itself)? If so, start there.  If not, look for it as a property of the parent object.

    • Andrii's avatar
      Andrii
      New Contributor

      Hi Robert, 

       

      Thank you for you reply. 

       

      It doesn't show the tooltip even if it is hardcoded as a string. In my example above: WPFObject("PART_ToggleButton", "").ToolTip - PART_ToggleButton is a parent object and ToolTip is a property. Object Spy shows ToolTip == "Null Object", when Snoop shows that the value is "Select Tenor". Because it is hardcoded it doesn't depend on the implementation.

       

      Thanks,

      Andrii

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Can you show me a screenshot of the object with the tool tip property with all the other properties on the object?

         

        I'm not familiar with the Snoop tool... however, I suspect that it's accessing the property differently than TestComplete.  Is it possible that the object that is represented in the tooltip property is not actually instantiated until the parent object is hovered over?  That almost seems to be what's going on.  

         

        As a test, use the "HoverMouse" action on the parent object and, with the mouse hovered, simply write a log message out to the log with the contents of the tool tip property to see if it actually records at that point.