- tristaanogreEsteemed Contributor
There is a Drag option already.
https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/onscreen/drag-action-onscreen-object.html - vthomeschoolmomSuper Contributor
Yes. Which requires you to calculate the coordinates of the destination. Not a fan. I want someone to calculate it for me. Of course, in the meantime I have to do it anyway. But as I look forward to training my team, I would rater not have to teach them that. So be it. But...
- cunderwCommunity Hero
You could create a script extension for them to use so you don't have to train them.
- vthomeschoolmomSuper Contributor
Yes, I know. Thanks.
- tristaanogreEsteemed Contributor
I actually have our drag method added to a script extension. The code looks like this:
function dragCalculatedDistance(startObject, destinationObject) { var startPoint, targetPoint, dragX, dragY; // Drag from the center of object A to the center of object B startPoint = startObject.WindowToScreen(startObject.Width/2, startObject.Height/2); targetPoint = destinationObject.WindowToScreen(destinationObject.Width/2, destinationObject.Height/2); dragX = targetPoint.X - startPoint.X; dragY = targetPoint.Y - startPoint.Y; startObject.Drag(-1, -1, dragX, dragY); }
I wrap that in a script extension and then the method is available for any project. Give this a try.
- vthomeschoolmomSuper Contributor
I will, thanks. I think you posted this elsewhere. I still with TestComplete had the ability natively.
- MLoetscherSenior Member
vthomeschoolmom This feature request already exists:
Since this one has already received nine votes of approval, I recommend you vote for this one as well.
Related Content
- 4 years ago
- 9 years ago
- 7 years ago
- 2 months ago