Package org.sikuli.api

Examples of org.sikuli.api.ScreenRegion


    MyScreen myScreen = new MyScreen(f);
    MyMouse myMouse = new MyMouse(f);
    MyPainter myPainter = new MyPainter(f);

    ScreenRegion s = new DesktopScreenRegion();
    s.setScreen(myScreen);

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

      API.pause(2000);
View Full Code Here


  public static void main(String[] args) throws MalformedURLException {
   
    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
    ScreenRegion viwAllTweetsLink = s.find(viwAllTweetsLinkImageTarget);
    mouse.click(viwAllTweetsLink.getCenter());
     
  }
View Full Code Here

    f2.pack();   
    f2.setVisible(true);
    f2.setLocation(600,20);
    f2.setTitle("MyApp 2");

    ScreenRegion s1 = new DesktopScreenRegion();
    s1.setScreen(f1);

    ScreenRegion s2 = new DesktopScreenRegion();
    s2.setScreen(f2);

    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);
      MyApp.rectangle(catRegion);
     
View Full Code Here

TOP

Related Classes of org.sikuli.api.ScreenRegion

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.