Re: QTP - double clicking an object (5199 Views)
Reply
Advisor
Posts: 35
Registered: ‎05-09-2013
Message 1 of 6 (5,303 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
Posts: 2
Registered: ‎05-31-2013
Message 2 of 6 (5,284 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
Posts: 35
Registered: ‎05-09-2013
Message 3 of 6 (5,271 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
Posts: 82
Registered: ‎07-06-2011
Message 4 of 6 (5,257 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
Posts: 35
Registered: ‎05-09-2013
Message 5 of 6 (5,199 Views)

Re: QTP - double clicking an object

Thanks for your solution, it is solved now.
.-asd-.
Occasional Visitor
Posts: 1
Registered: ‎10-16-2014
Message 6 of 6 (2,162 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.