Forum Discussion

dpiotrowski's avatar
dpiotrowski
Contributor
12 years ago

Dragging and dropping doesn't work reliably

Hello there.



I do a lot of drag and drop in our application under test so I'v created a function which drags an object from one position and drops it somewhere else.



Sub dragFromTo(start_x, start_y, end_x, end_y) 

  Call LLPlayer.MouseDown(MK_LBUTTON, start_x, start_y, 200)

  Call LLPlayer.MouseMove(end_x, end_y, 400)

  Call LLPlayer.MouseUp(MK_LBUTTON, end_x, end_y, 400)

End Sub



But the problem is, this doesn't work reliably - the tests which include
drag&drop operations may pass right after creating them, but sooner or later
during playback there are fails because drag&drop operation didn't
work properly (by not working properly I mean that the thing was actually dragged, I can see it on the screen, but after dropping it wasn't added to the new position, as if you dragged and dropped a file into a folder but it wasn't actually in this folder after dropping). I calculate the coordinates dynamically with objects bounds.



Do you have an idea what may be the the problem in this case, perhaps the timing? Is there any way to make the drag&drop any more reliable than the function above (having given the coordinates of the start and end point of the drag&drop operation) ?

2 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Daniel,



    TestComplete simulates user actions more quickly than a user would do them. Some applications cannot handle quick drag-and-drops properly so that you can face the issues you're describing. To avoid the issue, you can adjust the dragging speed in TestComplete.



    When using the Drag operation, you can control the dragging speed using the Dragging delay option in Tools > Current Project Properties > Playback. For example, you can increase it up to 50 ms (meaning 20 px drag per 50 ms) or higher to avoid possible dragging issues.



    If you prefer to use the LLPlayer object methods, try increasing the delays (the last parameter) to, say, 2000 (2 seconds).



    Let me know whether this helps.
  • Hello Helen,



    That's exactly how I've solved it a while ago - by increasing delays in LLPlayer methods (the drag&drop operations take now more time but they are finally reliable). But thank you anyway.