4 Ways to Capture Tool Tip using UFT (formerly QTP) (2024)

Beginners to UFT/QTP often get confused on how to retrieve and identifyTool Tip from various UI elements in UFT. Since Tool Tip appear on mouse hover event, people often resort to using mouseover events, which in my opinion doesn’t give consistent results. In this article, we will talk about the generic process using which we can capture tool tips from various applications.

Tool Tip is a GUI element which is used to provide hints or brief details about an item when you hover a mouse on it. This item can be a link, image, edit box or any GUI element where application demands extra helpful hints.

Here is an illustration. A tool tip – Visit the main page – comes up when we hover our mouse on the logo of Wikipedia.

4 Ways to Capture Tool Tip using UFT (formerly QTP) (1)

Tool tips can be seen in all types of apps, whether web based or desktop based applications.

General Process of Capturing a Tool Tip

  1. Hover your mouse to check whether the UI element has a tool tip associated with it.
  2. If it has a tool tip associated, make use of QTP’s object spy tool and check the property that contains the tool tip value.
  3. Most of the times, you will find that tool tip is present in title property.
  4. Use GetRoProperty to fetch the tool tip value.

We will make use of jsfiddle to show examples of tool tip usage.

4 Ways to Capture Tool Tip using UFT (formerly QTP) (2)

As can be seen in the screenshot above, the title for link is defined as Go to home page. If you hover over the link – LearnQTP – you will see a tool tip titled “Go to home page”.

Let us use the process described above to capture this tool tip. Here is how the object spy looks for the link shown above.

4 Ways to Capture Tool Tip using UFT (formerly QTP) (3)

The corresponding code to fetch this tool tip would be:

msgbox Browser("Edit fiddle - JSFiddle").Page("Edit fiddle - JSFiddle").Frame("result").Link("Learn QTP").GetRoProperty("title")

You can play with various values here.

Capture Tool Tip from an image

We will make use of Google home page logo to demonstrate tool tip capture.4 Ways to Capture Tool Tip using UFT (formerly QTP) (4)

In this case as well, the tool tip appears in the title tag.

4 Ways to Capture Tool Tip using UFT (formerly QTP) (5)

The corresponding code to fetch this tool tip would be:

msgbox Browser("Google").Page("Google").WebElement("India").GetRoProperty("title")

The two cases we discussed above were simple for the fact that that ‘Tool Tip’ was directly available using Object Spy. There will be cases where the tool tip is not directly attached with the object under consideration. In such cases, we can take help of XPath.

HP introduced object identification capabilities using XPath in QTP 11 which has continued through UFT 12. To demonstrate tool tip capturing with XPath, we will use this website. The tool tip associated with the first name edit box is Your first name is a optional

4 Ways to Capture Tool Tip using UFT (formerly QTP) (6)

If you Object Spy on this edit box, you won’t find the tool tip mentioned in any of the properties. Hence in this case, we will locate the property using XPath and the innerhtml property. You may ask, how should I write XPath expression? If you want a detailed tutorial on it check this article on XPath with QTP , if you are looking for an easier way read-on.

  1. Open this link in Google Chrome browser.
  2. Right click on the page and click on ‘Inspect Element’
  3. Use the little magnifying glass on the left and inspect ‘First Name’ edit box. Locate the tool tip in the console below.
  4. Highlight the row > Right Click > Copy XPath.

4 Ways to Capture Tool Tip using UFT (formerly QTP) (7)

XPath associated with the First Name tool tip class is //*[@id=’tp1′]

This piece of code will give you the tool tip associated with First Name edit box using XPath.

msgbox Browser("ARIA Example: Tooltip").Page("ARIA Example: Tooltip").WebElement("xpath:=//*[@id='tp1']").GetROProperty("innerhtml")

Capture Tool Tip Using CSS

Along with XPath, HP also introduced Object identification using CSS in QTP 11. The process for capturing CSS path for this element would remain the same. In this case, the CSS associated with First Name tool tip is #tp1

This piece of code will give you the tool tip associated with First Name edit box using CSS.

msgbox Browser("ARIA Example: Tooltip").Page("ARIA Example: Tooltip").WebElement("css:=#tp1").GetROProperty("innerhtml")

I hope this article will help you identify tool tips in your application. If you have used some other ways, please share in the comments section below.

Additional Reading: Capture Tool tip in a Java Application.

If you want to keep track of further articles on UFT (QTP). I recommend you to subscribe by email below and have new UFT articles sent directly to your inbox.

You Should Read These 3 Related Articles Too!

  • New Features of UFT 12: A Detailed Look
  • Tutorial 11: What is Smart Identification?
  • A Complete Guide to Descriptive Programming in QTP (UFT)
4 Ways to Capture Tool Tip using UFT (formerly QTP) (2024)
Top Articles
Latest Posts
Article information

Author: Maia Crooks Jr

Last Updated:

Views: 6131

Rating: 4.2 / 5 (43 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Maia Crooks Jr

Birthday: 1997-09-21

Address: 93119 Joseph Street, Peggyfurt, NC 11582

Phone: +2983088926881

Job: Principal Design Liaison

Hobby: Web surfing, Skiing, role-playing games, Sketching, Polo, Sewing, Genealogy

Introduction: My name is Maia Crooks Jr, I am a homely, joyous, shiny, successful, hilarious, thoughtful, joyous person who loves writing and wants to share my knowledge and understanding with you.