Unified Functional Testing Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

QTP - double clicking an object

SOLVED
Go to Solution
Advisor

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-.
1 ACCEPTED SOLUTION
Valued Contributor

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
5 REPLIES
Occasional Visitor

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

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

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
Highlighted
Advisor

Re: QTP - double clicking an object

Thanks for your solution, it is solved now.
.-asd-.
Occasional Visitor

Re: QTP - double clicking an object

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

 

Thanks