Monday

QTP - Setting.WebPackage("ReplayType") = 2

reference:
http://www.advancedqtp.com/forums/index.php/topic,584.0.html

Try to run with mouse events, instead of browser events.
Code
GeSHi (qtp):
Setting.WebPackage("ReplayType") = 2 'Mouse events (browser events = 1)


Created by GeSHI 1.0.7.20

I would like to elaborate on Meir's answer, by default QTP communicates with browser objects via DOM events this means that:
Browser().Page().WebElement().Click
Is equivalent to:
Browser().Page().WebElement().Object.Click

If the web application listens to other events they will not be produced. When using device replay QTP physically moves the mouse cursor and simulates a click so it's much closer emulating a user action. I would recommend localizing this change to a function library.
Code
GeSHi (qtp):
Public Function DeviceClick(test_object)

replayType =Setting.WebPackage("ReplayType")' save old state

Setting.WebPackage("ReplayType") = 2

test_object.Click

Setting.WebPackage("ReplayType") = replayType

End Function

RegisterUserFunc "WebElement", "DeviceClick", "DeviceClick"


Created by GeSHI 1.0.7.20

Then you can choose whether to use Click or DeviceClick.

No comments:

Post a Comment