Package org.sikuli.api

Examples of org.sikuli.api.ImageTarget


 
  public static void main(String[] args) {
    simulator.start();
   
    ScreenRegion s = new DesktopScreenRegion();
    Target imageTarget = new ImageTarget(Images.ThumbIcon);
 
    List<ScreenRegion> rs = s.findAll(imageTarget);
    int no = 1;
    for (ScreenRegion r : rs){
      canvas.addBox(r);
View Full Code Here


  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'   
    mouse.click(r.getCenter());   
    // Display a box around 'r' for 1 second
    canvas.addBox(r).display(1);

    // Find another image target and perform similar operations
    imageURL = Images.GoogleMicrophoneIcon;               
    imageTarget = new ImageTarget(imageURL);         
    r = s.find(imageTarget);            
    mouse.rightClick(r.getCenter());
    canvas.clear().addBox(r).display(1);

    // Find another image target and perform similar operations
    imageURL = Images.GoogleSearchFeelingLuckyButton;               
    imageTarget = new ImageTarget(imageURL);         
    r = s.find(imageTarget);
    mouse.doubleClick(r.getCenter());
    canvas.clear().addBox(r).display(1);

  }
View Full Code Here

    for (int i=0; i < 10; i++){

      f.moveButtonsRandomly();

      ScreenRegion dogRegion = s.find(new ImageTarget(Images.Dog));
      ScreenRegion catRegion = s.find(new ImageTarget(Images.Cat));

      myMouse.click(dogRegion.getCenter());
      myMouse.click(catRegion.getCenter());

      myPainter.rectangle(dogRegion);
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

    for (int i=0; i < 10; i++){
     
      f1.moveButtonsRandomly();
      f2.moveButtonsRandomly();

      ScreenRegion dogRegion = s1.find(new ImageTarget(Images.Dog));
      ScreenRegion catRegion = s2.find(new ImageTarget(Images.Cat));
           
      MyApp.click(dogRegion.getCenter());
      MyApp.click(catRegion.getCenter());
     
      MyApp.rectangle(dogRegion);
View Full Code Here

TOP

Related Classes of org.sikuli.api.ImageTarget

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.