Tooltip can’t be read by Quick Test Pro

  • Questions
  • Tooltip can't be read by Quick Test Pro
Question ID: 104987

I cannot get a tooltip text from Quick test since it pops up and can’t spy on object.

Marked as spam
Posted by (Questions: 4, Answers: 0)
Asked on April 30, 2013 4:09 pm
Answers (1)
Private answer

Tooltips are tricky with QTP. I have found that you can use mouse overs in conjunction with a property grab via descriptive programming. Please see my overview below which will give you an idea of how to approach this:

'There are a couple of ways to move the mouse to an object. One is with the DeviceReplay, and the other is with a direct mouse move.

'Example 1
Set obj = CreateObject(''Mercury.DeviceReplay'')
obj.MouseMove x, y

'Example 2
Window(''TestApp'').WinObject(''icon1'').MouseMove 22,15

'Next, follow the mouse movement with a delay and then a text capture using descriptive programming

Wait 2 '(delay to allow tooltip to appear)

' Capture the text of the tooltip object
txt= Window(''nativeclass:=.*tooltips_class32.*'',''index:=0'').GetROProperty(''regexpwndtitle'')
msgbox txt


'If the object is web-based, then you can use something like the following:

Browser(''Browser'').Page(''Page'').Link(''Link X'').MouseOver
' Wait a second to allow the tooltip to be displayed.
wait 1
' Capture the text of the tooltip object

txt= Window(''nativeclass:=.*tooltips_class32.*'',''index:=0'')
MsgBox txt

Marked as spam
Posted by (Questions: 2, Answers: 425)
Answered on April 30, 2013 4:11 pm