-5

I'm looking for a possibility to to this basically: User clicks, holds, moves to left and releases. EDIT: I mean not by an user, but automated. Any methods which offer this?

Huang Chen
  • 1,177
  • 9
  • 24
Tim V
  • 1
  • 2

1 Answers1

1

To automate mouse clicks, holds and moves you can look into the Robot Class

This is the basics of a mouse click: where x and y is the coordinate of the point on the screen in pixels where you want to click.

public static void click(int x, int y) throws AWTException{
    Robot bot = new Robot();
    bot.mouseMove(x, y);    
    bot.mousePress(InputEvent.BUTTON1_MASK);
    bot.mouseRelease(InputEvent.BUTTON1_MASK);
}

Other mouse functionality can be acheived through Selenium

Really depends on what you specfically want to acheive

See:

How to perform mouseover function in Selenium WebDriver using Java?

How to simulate a real mouse click using java?

If you record the coordinates accurately enough, and loop the amount of times you want to do the processes; you can pretty much automate most mouse clicks/drags.

Community
  • 1
  • 1
Huang Chen
  • 1,177
  • 9
  • 24