QTP - double clicking an object (3315 Views)
Reply
Advisor
RicoLee
Posts: 35
Registered: ‎05-09-2013
Message 1 of 6 (3,315 Views)
Accepted Solution

QTP - double clicking an object

Greetings, I want QTP to record the double click action but failed to. I've added event "ondblclick" in Web Event Recording Configuration, and tried the method below:

Browser("Home").Page("Util").WebFile("Icon").FireEvent "ondblclick" 

 Is there any solutions to work around this?

.-asd-.
Occasional Visitor
oculuss
Posts: 2
Registered: ‎05-31-2013
Message 2 of 6 (3,296 Views)

Re: QTP - double clicking an object

Switch out the element id and give this a try:

Browser("Browser").Page("Util").RunScript("var event = document.createEvent('HTMLEvents');event.initEvent('dblclick',true,false);document.getElementById('THEELEMENTSID').dispatchEvent(event);")
Advisor
RicoLee
Posts: 35
Registered: ‎05-09-2013
Message 3 of 6 (3,283 Views)

Re: QTP - double clicking an object

Thanks for your reply, I've tried as you suggested, but it is showing error as it says "JavaScript error occured in 'var even = document.....'" and :"Object doesn't support this property or method".

.-asd-.
Valued Contributor
Anshoo_Arora
Posts: 82
Registered: ‎07-06-2011
Message 4 of 6 (3,269 Views)

Re: QTP - double clicking an object

[ Edited ]

try these:

 

Setting.WebPackage("ReplayType") = 2
    Browser("Home").Page("Util").WebFile("Icon").FireEvent "ondblclick" 
Setting.WebPackage("ReplayType") = 1

 

Dim DeviceReplay, target, abs_x, abs_y

Set DeviceReplay = CreateObject ("Mercury.DeviceReplay")
Set target = Browser("Home").Page("Util").WebFile("Icon")

abs_x = target.GetROProperty("abs_x")
abs_y = target.GetROProperty("abs_y")

DeviceReplay.MouseMove abs_x, abs_y
DeviceReplay.MouseDblClick abs_x, abs_y, 0

Set DeviceReplay = Nothing

 

Any luck?


--
Anshoo Arora
Relevant Codes
LinkedIn
Advisor
RicoLee
Posts: 35
Registered: ‎05-09-2013
Message 5 of 6 (3,211 Views)

Re: QTP - double clicking an object

Thanks for your solution, it is solved now.
.-asd-.
Occasional Visitor
vamsi476
Posts: 1
Registered: 2 weeks ago
Message 6 of 6 (174 Views)

Re: QTP - double clicking an object

Me too faced the same problem.. Got solved by using  Setting.WebPackage("ReplayType")

 

Thanks

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.