Forum Discussion

mdrawdy's avatar
5 years ago

How to get the Tooltip text for test complete 14 and windows

After much trying to figure out how to get the tool tip text, this is what we found worked:

1. Add System.Windows.Controls.ToolTip to project:

    Double click on Project name in Project Workspace

    Click on Properties tab

    Go to Open Applications → WPF

    Under the 'Composite controls' tab of WPF Controls click the Add button 

    Add the System.Windows.Controls.ToolTip class and check the Active checkbox

    Save project


2. To view a tooltip in TestComplete's Object Browser without moving the mouse while hovering:

    Open and size the test complete window and the application windows so they are both visible on your monitor

    Open the Object Browser tab of Test complete 

    In the application window, hover the mouse on the desired tooltip

    Alt + Tab to change the window and go to the test complete window (use arrow keys to move from one  window to another)

    Ctrl+R to refresh the Object Browser 

    A PopupRoot  type process should appear under the process you are running in your application

    Use the up and down arrow keys to traverse through the objects till you get past the tooltip object to the textblock object that has the text ( in some cases we had multiple textblocks)


3. Here is some sample Python code to get the tooltip text:

    tooltipText = []

    popupRootChildren = Sys.Process("ProcessName").FindAllChildren("ClrClassName", "PopupRoot", 100)
    for popupRoot in popupRootChildren:
        tooltip = popupRoot.FindChild("ClrClassName", "ToolTip", 100)
        if (tooltip.Exists):
            textblockChildren = tooltip.FindAllChildren("ClrClassName", "TextBlock", 100)

            for textblock in textblockChildren: