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.
solved Click and drag option (JAVA)