Forum Discussion

HirendraSingh's avatar
HirendraSingh
Occasional Contributor
4 days ago
Solved

Read text from tooltip on hover

I want to read all the text displayed on tooltip and need to compare it with searched value, as when I hoven on record then tooltip appears with details and as soon as mouse is moved to another record then it disappears so how to capture that in testcomplete and used to compare properties.

Attaching screenshot for reference.

  • rraghvani's avatar
    rraghvani
    3 days ago

    I thought the popup that shows "ProfitCenter..." was a dialog, and that your were hovering over "Contains" dropdown list or "Testing" text field as highlighted! You need to be thoroughly clear when explaining, as we know nothing about your application.

    Since it's a web application, it makes it easier. Use the Object Browser, and then hover over  Details item "Providing Third Party Inspection...". The hierarchy list of items shown in the Object Browser will show another child item - this will most likely be the tooltip. 

    When hovering over the tooltip, Object Browser shows a new child item.

    When the details item loses focus, the child item will be removed. 

    When the item has lost focus, tooltip child item is removed

    Different web application behave differently, so it may not be exactly the same as I have explained it. But this will point you in the right direction, on how to locate the tooltip.

    You can also use browsers' DevTools to locate the class name too.

    You can then capture the contents of the tooltip, and use aqObject.CompareProperty method to verify the object’s property value according to your condition

     

6 Replies

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    It's tricky but doable, follow these steps to find the tooltip element in web applications:

    1. Open your app in the browser.
    2. Open DevTools Console (F12) and run:
      $x("//*[contains(., 'unique part of tooltip text')]")
      This generic XPath searches for any visible element (even nested ones) containing the tooltip text.
    3. Once found, inspect the element’s tag, class, or attributes. Use that info to build a refined XPath for use in TestComplete.

    This approach lets you capture the tooltip without moving the mouse or triggering it to disappear.

    🤖 AI-assisted response.
    💬 Was this helpful? Click Like to show appreciation.
    ✅ Got the answer you needed? Click Mark as Solution to help others find it too.

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Is this for a Desktop or a Web application? Are you hovering over the dropdown list or the text field? Your screenshot doesn't show the tooltip?

     

    • HirendraSingh's avatar
      HirendraSingh
      Occasional Contributor

      Its a Web application and the whole popup in which details are show is the tooltip when keep mouse on 1st record. You can see mouse pointer under Details column in Grid.

      I am hovering in Grid on record after searching data.

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        I thought the popup that shows "ProfitCenter..." was a dialog, and that your were hovering over "Contains" dropdown list or "Testing" text field as highlighted! You need to be thoroughly clear when explaining, as we know nothing about your application.

        Since it's a web application, it makes it easier. Use the Object Browser, and then hover over  Details item "Providing Third Party Inspection...". The hierarchy list of items shown in the Object Browser will show another child item - this will most likely be the tooltip. 

        When hovering over the tooltip, Object Browser shows a new child item.

        When the details item loses focus, the child item will be removed. 

        When the item has lost focus, tooltip child item is removed

        Different web application behave differently, so it may not be exactly the same as I have explained it. But this will point you in the right direction, on how to locate the tooltip.

        You can also use browsers' DevTools to locate the class name too.

        You can then capture the contents of the tooltip, and use aqObject.CompareProperty method to verify the object’s property value according to your condition