public static void sikuliDragAndDrop( LiferaySelenium liferaySelenium, String image, String coordString) throws Exception { ScreenRegion screenRegion = new DesktopScreenRegion(); ImageTarget imageTarget = getImageTarget(liferaySelenium, image); screenRegion = screenRegion.find(imageTarget); Mouse mouse = new DesktopMouse(); mouse.move(screenRegion.getCenter()); Robot robot = new Robot(); robot.delay(1000); mouse.press(); robot.delay(2000); String[] coords = coordString.split(","); Location location = screenRegion.getCenter(); int x = location.getX() + GetterUtil.getInteger(coords[0]); int y = location.getY() + GetterUtil.getInteger(coords[1]); robot.mouseMove(x, y); robot.delay(1000); mouse.release(); }
public static void sikuliMouseMove(LiferaySelenium liferaySelenium, String image) throws Exception { ScreenRegion screenRegion = new DesktopScreenRegion(); ImageTarget imageTarget = getImageTarget(liferaySelenium, image); screenRegion = screenRegion.find(imageTarget); Mouse mouse = new DesktopMouse(); mouse.move(screenRegion.getCenter()); }