// TODO: this is not working yet public static void main(String[] args) throws IOException, InterruptedException { URL backgroundImage = Images.GoogleSearchPage; URL dragTargetImage = Images.OSXDockIcon; DragDropFrame imageFrame = new DragDropFrame(backgroundImage, dragTargetImage); imageFrame.autoClose(10000); ScreenRegion s = new DesktopScreenRegion(); Mouse mouse = new DesktopMouse(); URL imageURL = Images.OSXDockIcon; Target imageTarget = new ImageTarget(imageURL); ScreenRegion r = s.wait(imageTarget, 1000); mouse.drag(r.getCenter()); imageURL = Images.GoogleMicrophoneIcon; imageTarget = new ImageTarget(imageURL); r = s.wait(imageTarget, 1000); mouse.drop(r.getCenter()); ScreenLocation c = mouse.getLocation(); mouse.drag(c); mouse.drop(Relative.to(c).left(200).above(50).getScreenLocation()); }
public static void sikuliAssertElementNotPresent(LiferaySelenium liferaySelenium, String image) throws Exception { ScreenRegion screenRegion = new DesktopScreenRegion(); ImageTarget imageTarget = getImageTarget(liferaySelenium, image); if (screenRegion.wait(imageTarget, 5000) != null) { throw new Exception("Element is present"); } }
public static void sikuliAssertElementPresent(LiferaySelenium liferaySelenium, String image) throws Exception { ScreenRegion screenRegion = new DesktopScreenRegion(); ImageTarget imageTarget = getImageTarget(liferaySelenium, image); screenRegion = screenRegion.wait(imageTarget, 5000); if (screenRegion == null) { throw new Exception("Element is not present"); } Canvas canvas = new DesktopCanvas(); ElementAdder elementAdder = canvas.add(); ElementAreaSetter elementAreaSetter = elementAdder.box(); elementAreaSetter.around(screenRegion); canvas.display(2); }