When
the user moves the mouse over some objects in his application, a
tooltip appears. Is there a way to capture the text displayed in the
tooltip?
Solution: Capture the text property for the tooltips_class32 control
1.
Move the mouse over the object. If you are testing Web objects, use the
MouseOver method, otherwise use the MouseMove method.
2. Wait a second or two for the tooltip to appear.
3.
Use descriptive programming to refer to the tooltip object. Most window
applications use the "tooltips_class32" class for tooltips. Use the
descriptive programming to find the object of that class.
4. Use GetROProperty to capture the text of the tooltip.
Example:'
Windows applications' Move the mouse over the
object.
Window("TextPad" ).WinObject( "Standard" ).MouseMove 22,15
' Wait a second to allow the tooltip to be displayed.
wait 1
' Capture the text of the tooltip object
txt = Window("nativeclass :=tooltips_ class32").GetROProperty( "text")
msgbox txt
'
Browser-based application' Mouseover the object.
Browser("Browser" ).Page("Page" ).Link("Link 1").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") .GetROProperty( "text")
msgbox txt
Note:If
your application uses a different class of object for the tooltip, you
may need to use the "Object Spy" (Tools -> Object Spy) to spy on the
tooltip to determine the class. After you click the hand button on the
Object Spy window, the mouse cursor will turn to a hand icon. Press and
hold the CTRL key to change the cursor to the normal state. Mouseover
the control to bring up the tooltip. Once the tooltip is up, release
the CTRL key and click on the tooltip immediately, before it
disappears.
If
you cannot use the Object Spy to determine the class of the tooltip
object, you may need to contact your developer for this information.
--
Dmitry Motevich