Drag And Drop not working

Asked by Sebastian

Drag and drop is not working. It is not able to drag the "from" cell to the "to" cell.

Human interaction "fixes" this problem, but the whole point of automation is NOT to have human interaction.

So here's the issue:
I tried what I could find in documentation, forums, and by myself.

Drag and Drop consists of 3 steps:
1) Left-mouse click on the cell you wish to drag and keep the left mouse button pressed.
2) Drag (or move) the cell above (hovering) the cell you wish to drop it to.
3) Release.

The problems occurs in #1. If in #1 the human user moves the mouse a bit, the left-mouse click DOES get registered and #2 and #3 work properly. Without human interaction, however, the mouse cursor does NOT pick up the "from" cell.

Is any help available for this?

Thank you,

-TS...

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

This seems to be a special drag/drop situation.

So you should try to simulate the "human behavior" with a series of

mouseDown()
mouseMove()
mouseUp()

in between you could insert appropriate wait()'s

Revision history for this message
Sebastian (sebastian-moldovan) said :
#2

Yes, of course I already tried that. No effect.

Here's what I tried:

lRegion = find("rl21Airplane.png");
click(lRegion.getCenter().above(1));
mouseMove("rl21Airplane.png");
mouseDown(Button.LEFT);
wait(2);
mouseMove(Env.getMouseLocation().offset(0, 100));
wait(2);
mouseUp(Button.LEFT);

This failed. I also tried sneaking in other interactions such as an escape key or additional clicks to "emulate" human behaviour. No offect. Of course I started out by trying dragDrop(img, img). I also tried using click().

No effect.

What is the problem? Can you help?

Thank you,

TS....

Revision history for this message
RaiMan (raimund-hocke) said :
#3

I guess the click() is the problem (it is a mouseDown/mouseUp).

what about:
lRegion = find("rl21Airplane.png");
mouseMove(lRegion)
mouseDown(Button.LEFT);
wait(0.5)
mouseMove(lRegion.getCenter().above(1))
wait(0.5)
mouseMove(Env.getMouseLocation().offset(0, 100));
wait(0.5);
mouseUp();

BTW: semicolons not needed in Python (only to separate statements on same line)

Revision history for this message
Hemant Shinde (hemantshinde) said :
#4

I was facing similar issue while trying to scroll on iPhome simulator.
The script started working after I increased the distance between drag and drop.
Looks like the simulators gives trouble for finer scrolls.

Can you help with this problem?

Provide an answer of your own, or ask Sebastian for more information if necessary.

To post a message you must log in.