Hi I am getting the below error when sikulix is used in eclipse

Asked by radhi12 on 2017-11-24

import org.sikuli.script.*;
import org.sikuli.script.Screen;
public class ab

{

   public static void main(String[] args) throws Exception {
     //Debug.setDebugLevel(3);
     Screen s = new Screen();

     s.click("imgs/Capture.PNG");
   }
}

error:

13:36:02:704 >> Loading HP UFT Java Support (version 12.0.0.0) (SUN 1.7.0)
[error] Image: could not be loaded: file:/C:/Users/xw66/workspace/Sikul/Capture.PNG
[error] Image: Image not valid, but TextSearch is switched off!
Exception in thread "main" FindFailed: imgs/Capture.PNG: (408x284) in S(0)[0,0 1366x768] E:Y, T:3.0
  Line 2759, in file Region.java

 at org.sikuli.script.Region.wait(Region.java:2759)
 at org.sikuli.script.Region.find(Region.java:2336)
 at org.sikuli.script.Region.getLocationFromTarget(Region.java:3213)
 at org.sikuli.script.Region.click(Region.java:3698)
 at org.sikuli.script.Region.click(Region.java:3683)
 at ab.main(ab.java:16)
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:"C:\Program Files (x86)\HP\Unified Functional Testing\bin\java_shared\classes";"C:\Program Files (x86)\HP\Unified Functional Testing\\bin\java_shared\classes\jasmine.jar"
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook

Question information

Language:
English Edit question
Status:
Open
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
16 hours ago
Last reply:
16 hours ago
radhi12 (radhi12) said : #1

Hi,

Can some one help me.

radhi12 (radhi12) said : #3

Hi Masuo,
Thanks for the prompt response but I already tried the urls you have mentioned and still the same issue.

Manfred Hampl (m-hampl) said : #4

Have you tried providing the full path to the image file in the s.click() statement?

radhi12 (radhi12) said : #5

Hi

i used the below code now and still issue is there.

import org.sikuli.script.*;
import org.sikuli.script.Screen;
public class ab

{

   public static void main(String[] args) throws Exception {
    ImagePath.setBundlePath("C:/Users/xw66/workspace/Sikul/imgs");

     Screen s = new Screen();

     s.click("C:/Users/xw66/workspace/Sikul/imgs/Capture.PNG");

   }
}

radhi12 (radhi12) said : #6

Hi M-hampl,

It would be great if you can help me.

Manfred Hampl (m-hampl) said : #7

Does this path really exist?
"Sikul" instead of "Sikuli"?
Have you tried backslashes instead of forward slashes (eventually even double backslashes)?

Can you please provide the error message that you receive, e.g.
[error] Image: could not be loaded: file:/C:/Users/xw66/workspace/Sikul/Capture.PNG
and verify whether such file really exists

radhi12 (radhi12) said : #8

Hi,

Please find the error.

17:08:09:136 >> Loading HP UFT Java Support (version 12.0.0.0) (SUN 1.7.0)
Exception in thread "main" FindFailed: Capture.PNG: (408x284) in S(0)[0,0 1366x768] E:Y, T:3.0
  Line 2759, in file Region.java

 at org.sikuli.script.Region.wait(Region.java:2759)
 at org.sikuli.script.Region.find(Region.java:2336)
 at org.sikuli.script.Region.getLocationFromTarget(Region.java:3213)
 at org.sikuli.script.Region.click(Region.java:3698)
 at org.sikuli.script.Region.click(Region.java:3683)
 at ab.main(ab.java:15)
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:"C:\Program Files (x86)\HP\Unified Functional Testing\bin\java_shared\classes";"C:\Program Files (x86)\HP\Unified Functional Testing\\bin\java_shared\classes\jasmine.jar"
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook

backslashes also not working.

Please let me know if you need any webex to show this.File path is correct only.

Manfred Hampl (m-hampl) said : #9

If you look closely enough, you will see that the error message now is different:

Earlier it was "... Image: could not be loaded ..." i.e. the program could not load the image.
Now it is "... FindFailed: Capture.PNG ..." i.e. the program was able to load the image for comparison (apparently the slashes or backslashes were now correct), but it did not find a similar image on the screen.

radhi12 (radhi12) said : #10

Hello, Please advice me what has to be done to resolve this.

Manfred Hampl (m-hampl) said : #11

There is nothing to resolve.

You have a "capture.png" image, and try to find whether a similar image is shown on the screen and click on it.
With a plain "*.click()" instruction you will receive the error message "FindFailed", if such image is not shown on the screen. This is expected behavior.

Some more details are available in the documentation, e.g. http://sikulix-2014.readthedocs.io/en/latest/region.html

What do you want to achieve?
You should always take into account the possibility, that the image (button etc.) which you want to click is not shown on screen.

radhi12 (radhi12) said : #12

Hello, when I tried sikuli using sikuli ide it was able to capture the image but when we used eclipse the issue of image occurs.Please assist me as I don't know how to proceed.

radhi12 (radhi12) said : #13

Hi,

Can some one assist me as I am completely stuck.

Manfred Hampl (m-hampl) said : #14

Can you please provide more details about what you want to achieve.

What do you do, what do you expect that happens, and what is happening instead?

radhi12 (radhi12) said : #15

i just need that image capture.png to be opened when i run the script in eclipse-sikuli.

I just created the above program and want the image to be opened in my system but now I am getting the error.

Manfred Hampl (m-hampl) said : #16

What do you mean by "opening the image"?

radhi12 (radhi12) said : #17

Opening the image means clicking on the image.

On Nov 29, 2017 1:23 AM, "Manfred Hampl" <
<email address hidden>> wrote:

> Your question #661057 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/661057
>
> Status: Open => Needs information
>
> Manfred Hampl requested more information:
> What do you mean by "opening the image"?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/sikuli/+question/661057
>
> You received this question notification because you asked the question.
>

radhi12 (radhi12) said : #18

Hi,

Can anyone help.

RaiMan (raimund-hocke) said : #19

There is nothing new in your situation, all is said:
comment #9: the image is not visible on the screen or cannot be found because of other reasons (e.g. when running from inside Eclipse, then the image might be on the screen, but is hidden by the Eclipse window).
Be aware: visible means YOU must see it.

radhi12 (radhi12) said : #20

Hi,
let me know if I can create a webex and show you so that you guys can help me resolve.

RaiMan (raimund-hocke) said : #21

What about just answering on comment #19?

You might as well just use the SikuliX IDE to make some basic tests for your situation.

radhi12 (radhi12) said : #22

When I m trying with sikuli ide it is working fine only using eclipse
sikuli it is not working

On Dec 6, 2017 2:17 AM, "RaiMan" <email address hidden>
wrote:

> Your question #661057 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/661057
>
> Status: Open => Needs information
>
> RaiMan requested more information:
> What about just answering on comment #19?
>
> You might as well just use the SikuliX IDE to make some basic tests for
> your situation.
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/sikuli/+question/661057
>
> You received this question notification because you asked the question.
>

RaiMan (raimund-hocke) said : #23

Again: What about just answering on comment #19?

Do YOU see the image, while running test with Eclipse?

radhi12 (radhi12) said : #24

Hi,

 I minimized the eclipse window and ran but still same issue is there.

image is in my workspace folder.

Do you need a webex so that I can give a walkthrough.

radhi12 (radhi12) said : #25

Hi can anyone help

On Dec 6, 2017 4:33 PM, "radhi12" <email address hidden>
wrote:

> Your question #661057 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/661057
>
> Status: Needs information => Open
>
> You gave more information on the question:
> Hi,
>
> I minimized the eclipse window and ran but still same issue is there.
>
> image is in my workspace folder.
>
> Do you need a webex so that I can give a walkthrough.
>
> --
> You received this question notification because you asked the question.
>

Manfred Hampl (m-hampl) said : #26

Do you see the image on the screen when you run the program - not the icon of the file, but the image?

radhi12 (radhi12) said : #27

no i m not seeing it.

On Thu, Dec 7, 2017 at 1:42 PM, Manfred Hampl <
<email address hidden>> wrote:

> Your question #661057 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/661057
>
> Status: Open => Needs information
>
> Manfred Hampl requested more information:
> Do you see the image on the screen when you run the program - not the
> icon of the file, but the image?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/sikuli/+question/661057
>
> You received this question notification because you asked the question.
>

Manfred Hampl (m-hampl) said : #28

If you do not see the image on screen, then Sikuli cannot see it either and will report a FindFailed exception.

radhi12 (radhi12) said : #29

I have placed it in c drive and not desktop.can u help me how to find the
image or can u help me.

On Dec 8, 2017 8:18 AM, "Manfred Hampl" <
<email address hidden>> wrote:

> Your question #661057 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/661057
>
> Status: Open => Answered
>
> Manfred Hampl proposed the following answer:
> If you do not see the image on screen, then Sikuli cannot see it either
> and will report a FindFailed exception.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/661057/+
> confirm?answer_id=27
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/661057
>
> You received this question notification because you asked the question.
>

Manfred Hampl (m-hampl) said : #30

You are confusing two different issues:

You have to make a screen shot of an area of the screen and store it somewhere on your system in a file, usually in PNG format and with a file name that can be something like "capture.png" or "1477780579267.png" (this number is based on date and time of making the screen shot).

1. In your first attempt the file name that you gave in your program was wrong, and sikuli could not access the file, because it was not available in the directory that sikuli uses for these files.
This gave the error message "Image: could not be loaded: file:/C:/Users/xw66/workspace/Sikul/Capture.PNG"

2. In a later attempt you apparently have corrected the file name of the capture file (probably needs double backslashes). You can see this in the error message, which does no more say "image could not be loaded". This means that sikuli was able to access the screenshot file.

The reason why you now get a FindFailed exception is the following:
The screenshot file contains an image which is not visible on the screen.

Something like: You instruct sikuli to search for a big red rectangle on the screen, but there is no such rectangle visible on the screen. Sikuli tells you that it does not find such image by raising a FindFailed exception.

There is no way that we can help you "how to find the image" if such image is not visible on your screen.

Sikuli can only click on an area of the screen if it knows where to click. If you instruct síkuli to click in the area where the image is, but sikuli cannot identify such image on the screen, then sikuli will always give this exception.

Maybe we can help further, if you tell us what exactly you want to achieve with sikuli.

radhi12 (radhi12) said : #31

Shall I setup webex so that I can walk u through

On Dec 8, 2017 11:52 AM, "Manfred Hampl" <
<email address hidden>> wrote:

> Your question #661057 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/661057
>
> Status: Open => Answered
>
> Manfred Hampl proposed the following answer:
> You are confusing two different issues:
>
> You have to make a screen shot of an area of the screen and store it
> somewhere on your system in a file, usually in PNG format and with a
> file name that can be something like "capture.png" or
> "1477780579267.png" (this number is based on date and time of making the
> screen shot).
>
> 1. In your first attempt the file name that you gave in your program was
> wrong, and sikuli could not access the file, because it was not available
> in the directory that sikuli uses for these files.
> This gave the error message "Image: could not be loaded:
> file:/C:/Users/xw66/workspace/Sikul/Capture.PNG"
>
> 2. In a later attempt you apparently have corrected the file name of the
> capture file (probably needs double backslashes). You can see this in
> the error message, which does no more say "image could not be loaded".
> This means that sikuli was able to access the screenshot file.
>
> The reason why you now get a FindFailed exception is the following:
> The screenshot file contains an image which is not visible on the screen.
>
> Something like: You instruct sikuli to search for a big red rectangle on
> the screen, but there is no such rectangle visible on the screen. Sikuli
> tells you that it does not find such image by raising a FindFailed
> exception.
>
> There is no way that we can help you "how to find the image" if such
> image is not visible on your screen.
>
> Sikuli can only click on an area of the screen if it knows where to
> click. If you instruct síkuli to click in the area where the image is,
> but sikuli cannot identify such image on the screen, then sikuli will
> always give this exception.
>
> Maybe we can help further, if you tell us what exactly you want to
> achieve with sikuli.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/661057/+
> confirm?answer_id=29
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/661057
>
> You received this question notification because you asked the question.
>

radhi12 (radhi12) said : #32

Hi,

My image is in the path s.doubleClick(new
Pattern("C:/Users/xw66/workspace/Sikul/imgs/abc.PNG"))..Please let me know
if i have to open this path :C:/Users/xw66/workspace/Sikul/imgs/abc.PNG and
keep for sikuli eclipse to identify.

On Fri, Dec 8, 2017 at 5:02 PM, radhi12 <
<email address hidden>> wrote:

> Your question #661057 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/661057
>
> Status: Answered => Open
>
> You are still having a problem:
> Shall I setup webex so that I can walk u through
>
> On Dec 8, 2017 11:52 AM, "Manfred Hampl" <
> <email address hidden>> wrote:
>
> > Your question #661057 on Sikuli changed:
> > https://answers.launchpad.net/sikuli/+question/661057
> >
> > Status: Open => Answered
> >
> > Manfred Hampl proposed the following answer:
> > You are confusing two different issues:
> >
> > You have to make a screen shot of an area of the screen and store it
> > somewhere on your system in a file, usually in PNG format and with a
> > file name that can be something like "capture.png" or
> > "1477780579267.png" (this number is based on date and time of making the
> > screen shot).
> >
> > 1. In your first attempt the file name that you gave in your program was
> > wrong, and sikuli could not access the file, because it was not available
> > in the directory that sikuli uses for these files.
> > This gave the error message "Image: could not be loaded:
> > file:/C:/Users/xw66/workspace/Sikul/Capture.PNG"
> >
> > 2. In a later attempt you apparently have corrected the file name of the
> > capture file (probably needs double backslashes). You can see this in
> > the error message, which does no more say "image could not be loaded".
> > This means that sikuli was able to access the screenshot file.
> >
> > The reason why you now get a FindFailed exception is the following:
> > The screenshot file contains an image which is not visible on the screen.
> >
> > Something like: You instruct sikuli to search for a big red rectangle on
> > the screen, but there is no such rectangle visible on the screen. Sikuli
> > tells you that it does not find such image by raising a FindFailed
> > exception.
> >
> > There is no way that we can help you "how to find the image" if such
> > image is not visible on your screen.
> >
> > Sikuli can only click on an area of the screen if it knows where to
> > click. If you instruct síkuli to click in the area where the image is,
> > but sikuli cannot identify such image on the screen, then sikuli will
> > always give this exception.
> >
> > Maybe we can help further, if you tell us what exactly you want to
> > achieve with sikuli.
> >
> > --
> > If this answers your question, please go to the following page to let us
> > know that it is solved:
> > https://answers.launchpad.net/sikuli/+question/661057/+
> > confirm?answer_id=29
> >
> > If you still need help, you can reply to this email or go to the
> > following page to enter your feedback:
> > https://answers.launchpad.net/sikuli/+question/661057
> >
> > You received this question notification because you asked the question.
> >
>
> --
> You received this question notification because you asked the question.
>

Manfred Hampl (m-hampl) said : #33

Please clearly state what the problem is.

What do you do
What do you expect to happen
What happens instead

radhi12 (radhi12) said : #34

Can I create a WebEx now and can we talk

On Dec 10, 2017 10:27 AM, "Manfred Hampl" <
<email address hidden>> wrote:

> Your question #661057 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/661057
>
> Status: Open => Needs information
>
> Manfred Hampl requested more information:
> Please clearly state what the problem is.
>
> What do you do
> What do you expect to happen
> What happens instead
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/sikuli/+question/661057
>
> You received this question notification because you asked the question.
>

radhi12 (radhi12) said : #35

i expect it to click the image but still getting find failed error.Can we
have a webex created as this has been pending since 3 weeks.

On Sun, Dec 10, 2017 at 10:27 AM, Manfred Hampl <
<email address hidden>> wrote:

> Your question #661057 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/661057
>
> Status: Open => Needs information
>
> Manfred Hampl requested more information:
> Please clearly state what the problem is.
>
> What do you do
> What do you expect to happen
> What happens instead
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/sikuli/+question/661057
>
> You received this question notification because you asked the question.
>

RaiMan (raimund-hocke) said : #36

3 weeks is indeed a long time for not getting nearer to a solution.

We expect, that you answer our questions in detail and seriously and that you yourself invest some trying and thinking.
It is not the job of this voluntary community to solve your problems nor to do your job.

Someone who does not take his time, to write down in detail, what he has done and what he wants to achieve, will never get valuable answers.

... and using the launchpad e-mail channel instead of the web-frontend most of the time is not very friendly to the other community members.

you say:
i expect it to click the image but still getting find failed error

... then, when I look at this thread, you should have learned until now about the possible reasons and after 3 weeks be able to track down the problem.

radhi12 (radhi12) said : #37

Hi,
i just changed my code as below.

mport java.awt.event.KeyEvent;

import org.sikuli.script.*;
import org.sikuli.script.Screen;
public class ab

{

  public static void main(String[] args) throws Exception {
  ImagePath.setBundlePath("C:/Users/xw66/workspace/Sikul/imgs");

    Screen s = new Screen();

   Pattern p = new Pattern("C:/Users/xw66/workspace/Sikul/imgs/abc.PNG");

   s.doubleClick(p);

  }

}
I opened the path :C:/Users/xw66/workspace/Sikul/imgs/abc.PNG and kept
before running eclipse so that sikuli and recognise the path and the
object.This also doesnt resolve my issue.

On Sun, Dec 10, 2017 at 11:02 AM, RaiMan <
<email address hidden>> wrote:

> Your question #661057 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/661057
>
> Status: Open => Answered
>
> RaiMan proposed the following answer:
> 3 weeks is indeed a long time for not getting nearer to a solution.
>
> We expect, that you answer our questions in detail and seriously and that
> you yourself invest some trying and thinking.
> It is not the job of this voluntary community to solve your problems nor
> to do your job.
>
> Someone who does not take his time, to write down in detail, what he has
> done and what he wants to achieve, will never get valuable answers.
>
> ... and using the launchpad e-mail channel instead of the web-frontend
> most of the time is not very friendly to the other community members.
>
> you say:
> i expect it to click the image but still getting find failed error
>
> ... then, when I look at this thread, you should have learned until now
> about the possible reasons and after 3 weeks be able to track down the
> problem.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/661057/+
> confirm?answer_id=35
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/661057
>
> You received this question notification because you asked the question.
>

Manfred Hampl (m-hampl) said : #38

Perhaps https://www.chiark.greenend.org.uk/~sgtatham/bugs.html could also serve a bit to better understand what the supporters may need.

RaiMan (raimund-hocke) said : #39

@Manfred
Thanks for this valuable link.
Nearly 20 years old, but could have been written today.
... and on this occasion: thanks for your contributions. really saves me some time.

Can you help with this problem?

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

To post a message you must log in.