Monday, 21 May 2012

Capturing Tool Tip Of A Link In QTP

As we know that the Tool tip or infotip or a hint is a common graphical user interface element. It's used in conjunction with a cursor,usually a pointer.The user hovers the pointer over an item without clicking it, and a tooltip may appear - a small "hover box" with information about the item being hovered over.

Capturing Toop Tip(TT) in QTP is not a difficult task. We need to follow some steps to achieve this.

01. Place the mouse cursor over the link
02. Wait for tool tip
03. Get Text of the shown tool tip

Use the following code snippet to capture the text of a tool tip.

'Place the mouse cursor over the link
Browser("aaa").Page("bbb").WebElement("text:=Link Name").FireEven "onmouseover"
Wait 3
'Grab the tool tip

Please read the following steps which explains the details about the above code snippet.

01.We use FireEvent("onmouseover") to simulate mouse placing over the link.
02.Function Wait waits for 3 seconds for a tool tip.
03.To get tool tip we used the "("nativeclass:=tooltips_class32").GetROProperty("text")"

We can compare the captured tool tip with the expected if required. I hope this article is helpful in capturing the Tool tip of any link


Post a Comment

Back To Top