Unable to click on Images when sikuli jar is integrated with eclipse.

Asked by Sayani Biswas on 2019-09-11

Trying to automate desktop application in MAC using 'sikulixsetup-1.1.3.jar' with Eclipse Neon.

I am trying to capture the spotlight icon and want to click on it. Below is the code snippet. My maven project hierarchy is

/Users/ABC/Desktop/EclipseWorkspace/com.apttus.sikuli.test

Images are stored under the same project hierarchy.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
package com.apttus.sikuli.test.com.apttus.sikuli.test;

import java.io.File;

import org.sikuli.script.FindFailed;
import org.sikuli.script.ImagePath;
import org.sikuli.script.Screen;

public class SikuliTrialSpotlight {
 public static void main(String atgs[]) throws InterruptedException {
  Screen s = new Screen();
  try {
   System.out.println(ImagePath.getBundlePath());
   //Thread.sleep(500);
   System.out.println("User Directory");
   System.out.println(System.getProperty("user.dir"));

   s.find("SpotlightIcon.png");

   s.click("SpotlightIcon.png");
   s.wait("Spotlight_input.png");
   //s.type(null, "hello world\n", 0);
  } catch (FindFailed e) {
   e.printStackTrace();
  }
 }

}

Whenever, I try to run the code, its throwing error :

/Users/sayanisengupta/Desktop/EclipseWorkspace/com.apttus.sikuli.test
User Directory
/Users/sayanisengupta/Desktop/EclipseWorkspace/com.apttus.sikuli.test
FindFailed: SpotlightIcon.png: (80x52) in S(0)[0,0 1680x1050] E:Y, T:3.0
  Line 2761, in file Region.java

 at org.sikuli.script.Region.wait(Region.java:2761)
 at org.sikuli.script.Region.find(Region.java:2326)
 at com.apttus.sikuli.test.com.apttus.sikuli.test.SikuliTrialSpotlight.main(SikuliTrialSpotlight.java:21)

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2019-09-11
Last reply:
2019-09-12
RaiMan (raimund-hocke) said : #1

read the docs about FindFailed situations to understand.

YOU must see the image on the screen. If it is hidden behind another window (e.g. Eclipse) it cannot be found.
So take care it is visible.

Can you help with this problem?

Provide an answer of your own, or ask Sayani Biswas for more information if necessary.

To post a message you must log in.