In page Page Flow, I want to drag the "Source" from left panel to right panel by java Robot. The following is the sample code.
public static void main(String[] args) throws AWTException{
Point start = new Point(184, 124);
Point end = new Point(386, 175);
int buttonMasks = InputEvent.BUTTON1_DOWN_MASK;
java.awt.Robot robot = new java.awt.Robot();
robot.mouseMove(start.x, start.y);
robot.delay(1000);
robot.mousePress(buttonMasks);
robot.delay(1000);
robot.mouseMove(end.x, end.y);
robot.delay(1000);
robot.mouseRelease(buttonMasks);
robot.delay(250);
}
But I can only see the mouse cursor is moved to the right panel, not the "Source" component. After execution, if I move the mouse MANUALLY back to the left panel, I can see that mouse is dragging the "Source" component, it is very weird. I guess that there is something with the javascript code on that page, the way it handles mouse event.
After robot makes a mousePress at line 08, if I make a long delay at line 09, for example robot.delay(5000);, and I move the mouse MANUALLY to the right panel, the "Source" component can be moved!
Anybody knows the reason?