Package org.sikuli.api

Examples of org.sikuli.api.Target


  public static void main(String[] args) throws IOException {
    simulator.start();

    ScreenRegion s = new DesktopScreenRegion();
   
    Target imageTarget = new ImageTarget(Images.ThumbIcon);

    ScreenRegion thumb = s.find(imageTarget);

    ScreenRegionCanvas canvas = new ScreenRegionCanvas(s);
    canvas.addBox(thumb);
    canvas.addLabel(Relative.to(thumb).topLeft().above(20).getScreenLocation(), "ImageTarget:");
    canvas.addImage(Relative.to(thumb).topLeft().above(25).right(85).getScreenLocation(), ImageIO.read(Images.ThumbIcon));
    canvas.display(3);

    Target target = new ImageTarget(Images.UncheckedCheckbox);   
    List<ScreenRegion> checkboxes = s.findAll(target);

    canvas.clear();   
    int no = 1;
    for (ScreenRegion r : checkboxes){     
View Full Code Here


        canvas.display(1);
      }         
    };

    // watch the dog and the cat in the screen region
    Target cat = new ImageTarget(Images.Cat);
    Target dog = new ImageTarget(Images.Dog);
    smallRegion.addTargetEventListener(dog, l);            
    smallRegion.addTargetEventListener(cat, l);
  }
View Full Code Here

    // default monitor in full screen
    ScreenRegion s = new DesktopScreenRegion()
   
    // Define an image target on the screen
    URL imageURL = Images.GoogleSearchButton;               
    Target imageTarget = new ImageTarget(imageURL);
    // Issue the find command and get a new screen region
    // 'r' corresponding to the screen region occupied
    // by the found target
    ScreenRegion r = s.find(imageTarget);   
    // Click the center of 'r'   
View Full Code Here

   
    browse(new URL("http://www.twitter.com/search"));

    ScreenRegion s = new DesktopScreenRegion();
       
    Target searchButtonImageTarget = new ImageTarget(Images.TwitterSearchButton);
       
    ScreenRegion searchButton = s.wait(searchButtonImageTarget, 5000);
   
    // Pause one second to allow search results to load
    pause(1000);       
   
    keyboard.type("sikuli");
   
    ScreenLocation outside = Relative.to(searchButton).right(50).center().getScreenLocation();
    mouse.click(outside);
       
    mouse.click(searchButton.getCenter());
   
    // Pause one second to allow search results to load
    pause(1000);
         
    // Scroll-down until the "View All Tweets Link" becomes visible
    Target viwAllTweetsLinkImageTarget = new ImageTarget(Images.TwitterViewAllTweetsLink);
    while (s.find(viwAllTweetsLinkImageTarget) == null) {
      keyboard.type(Key.PAGE_DOWN);         
    }
   
    // Find and click on the link
View Full Code Here

            " to {" + event.getNewState() + "}");           
      }         
    };


    Target cat = new ImageTarget(Images.Cat);
    Target dog = new ImageTarget(Images.Dog);

    smallRegion.addState(cat, "HAS A CAT");
    smallRegion.addState(dog, "HAS A DOG");
    smallRegion.addStateChangeEventListener(l);
View Full Code Here

TOP

Related Classes of org.sikuli.api.Target

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.