2

I am having an issue trying to find an image on the screen, I tried doing it in two different ways and it doesn't seem to work for me.

I am trying to do this with Appium running on IOS simulator which shows up on the screen, so I don't see this being a problem of a screenshot being taken.

I am running MAC OSX El Capitan I have imported the Sikuli X java API in my project

Do I need to also import the MAC Sikuli Library jar?

This is what I have tried so far:

1.

Screen s = new Screen();
    Pattern test = new Pattern("/Users/ealiaj/Desktop/Automation/workspace/WheelsUp - IOS/screenshot.jpg");
    try {
   s.find(test);
  } catch (FindFailed e) {
  }

2.

Screen s = new Screen();
    try {
   s.find("screenshot.jpg");
  } catch (FindFailed e) {
  }

I keep getting errors about not being able to find the image.

2

If you get match failures your environment is OK. Usually these errors are due to differences between your pattern and the screen image, possibly due to resolution changes or some such.

  1. You can try another function which gives a smoother script flow.

    s.exists()

  2. You can let your script show where it matches to see if you are where you think you are.

    s.highlight()

  3. Use the script to capture the screen dump, use this to double-check/replace your pattern "screenshot.jpg".

    file = s.capture(s.getBounds())

The above follows Python syntax. Look here for a more Java specific hint.

These are just generic hints. Without the actual error messages I have no idea what else you can try. Hope it helps, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.