← Back to team overview

sikuli-driver team mailing list archive

[Question #234436]: How to handle FindFailed exception in 1.0.1 from sikuli-script.jar

 

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

1. Using Sikuli 1.0.0 sikuli-script.jar
     - Created a Java class that performs a Sikuli script and import org.sikuli.script.FindFailed
     - Wrapped your Sikuli script actions in a try-catch block and catch the missing exception as follows:
import org.sikuli.script.FindFailed;
import org.sikuli.script.Key;
import org.sikuli.script.Match;
import org.sikuli.script.Screen;
        Import
        try {
        Screen myScreen= new Screen();
        ...
        ...
        myScreen.type(Key.F1);
        ....
        }
  catch( FindFailed e ) {
     Assert.fail( "Error with Sikuli script: " + e.getMessage() );
     e.printStackTrace();
     throw new AssertionError( e.getMessage() );
  }

2. Upgraded to sikuli 1.0.1 sikuli-script.jar
     Getting compilation error - FindFailed is never thrown in body of try statement

   Please advise

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.