public static void main(String[] args) { simulator.start(); ScreenRegion s = new DesktopScreenRegion(); URL imageURL = Images.GoogleSearchButton; Target imageTarget = new ImageTarget(imageURL); ScreenRegion r = s.find(imageTarget); canvas.addBox(Relative.to(r).right(100).getScreenRegion()); canvas.addLabel(Relative.to(r).right(100).center().getScreenLocation(), "right"); canvas.addBox(Relative.to(r).left(100).getScreenRegion()); canvas.addLabel(Relative.to(r).left(100).center().getScreenLocation(), "left"); canvas.addBox(Relative.to(r).above(100).getScreenRegion()); canvas.addLabel(Relative.to(r).above(100).center().getScreenLocation(), "above"); canvas.addBox(Relative.to(r).below(100).getScreenRegion()); canvas.addLabel(Relative.to(r).below(100).center().getScreenLocation(), "below"); canvas.display(3); mouse.click(Relative.to(r).center().getScreenLocation()); mouse.click(Relative.to(r).topLeft().getScreenLocation()); mouse.click(Relative.to(r).topRight().getScreenLocation()); mouse.click(Relative.to(r).bottomRight().getScreenLocation()); mouse.click(Relative.to(r).bottomLeft().getScreenLocation()); }
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); }