Micro Focus QTP (UFT) Forums

Full Version: FireEvent "onmouseover" doesn't work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I wanted to capture tool tip. for that I used following code.
But the problem is QTP executes it, also shows the result as "done" for that step. It actually (practically) doesn't hover the pointer at the link. Due to this, it does not capture the tool tip because tool tip does not appear only.

During execution, I manually hover the pointer at the link or anywhere, whatever tool tip appeared, it captured and it worked. Only the problem is, even after executing the "FireEvent" method successfully, it does not perform the action.
Please tell me what is the solution.

Code:-

Code:
' Place mouse cursor over the link
'Browser("abc").Page("abc").Frame("xyz").Link("opq").FireEvent "onmouseover"
'wait 1
' Grab tooltip
'ToolTip = Window("nativeclass:=tooltips_class32").GetROProperty("text")
'msgbox (ToolTip)
Below 2 possible solutions for the webobject s

Usually all the web Object which have tool tip value you can get using
Code:
Browser("abc").Page("abc").Frame("xyz").Link("opq").GetROProperty("alt")

In some other cases you will title in outerhtml
Code:
sOuterHtml =  wImageObject.GetROPRoperty("outerhtml")    
sHelptext = Trim(Mid (sOuterHtml, InStr(1, sOuterHtml, "title="), InStr(1, sOuterHtml, "src=") - InStr(1, sOuterHtml, "title=")))
sHelptext = Mid (sHelptext, InStr(1, sHelptext, """"))
sHelptext = Mid (sHelptext, 2, Len(sHelptext)-2)
Code:
Dim mm
mm=browser("Google").Page("Google").image("Google").GetROProperty("alt")
msgbox mm,0
But for me, problem is....Tool tip does not display the text of that link.

It gives some other message....
e.g. If text of the link is "abc"...but tool tip will display "click to ..."
Hi,

The above code works when you set the replay type as 'Mouse'.

To do this, visit the 'Tools -> Option' menu in QTP. Click the Advanced Option in the Web menu. By Default Run Settings -> 'Event' option will be selected. Change it to 'Mouse' and apply the settings.

Run the code
Code:
'Browser("abc").Page("abc").Frame("xyz").Link("opq").FireEvent "onmouseover"
'wait 1
' Grab tooltip
'ToolTip = Window("nativeclass:=tooltips_class32").GetROProperty("text")
'msgbox (ToolTip)

Will work fine.

The replay type can also be set using:
Code:
Setting.Webpackage("ReplayType") = 1
Setting.Webpackage("ReplayType") = 2

where, 1 is for Event Replay type and 2 is for Mouse Replay type.
Thanks