← Back to team overview

sikuli-driver team mailing list archive

[Question #277315]: Can't get onAppear to work.

 

New question #277315 on Sikuli:
https://answers.launchpad.net/sikuli/+question/277315

Hello,

I'm evaluating SikuliX (V1.1.0) as a possible testing tool for our automation test effort.  At present I'm writing all of my tests in Java as I know the language much better than Python. So here's my problem, my event handles never seem to get called.  The code below is running on Windows 7 and the two images are of the Windows Start button and the color picker from Paint.  When I run this program it clicks the start button and the Windows start menu appears I then manually click on Paint and it appears.  I would assume that as soon as Paint appeared my handler would be called but it is not.  I've tried a couple of the onAppear, onVanish, onChange and I can't seem to get any of them to work.  Any help or working Java examples would be appreciated.

Thanks,
Spence

import org.sikuli.script.ObserveEvent;
import org.sikuli.script.ObserverCallBack;
import org.sikuli.script.Screen;

public class SikulixEval
   {
   public static void main(String[] args)
      {
      Screen screen = new Screen();
      try
         {
         screen.onAppear("images/ColorPicker.png", new ObserverCallBack()
            {
               @Override
               public void appeared(ObserveEvent event)
                  {
                  try
                     {
                     System.out.println("Handler called.");
                     }
                  catch (Exception exc)
                     {
                     }
                  }
            });
         screen.click("images/StartButton.png");
         Thread.sleep(10000);
         }
      catch (Exception e)
         {
         }
      System.out.println("Finished.");
      }
   }

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.