Eclipse on Mac unable to find images

Asked by Vince

I've been able to successfully setup Sikuli to run in my Eclipse in Windows. Now I am trying it on a Mac and can't seem to get it to work. Any help would be appreciated.

The problem I am having is getting Eclipse on my Mac to find the image files. I can get it to launch applications using the App.open() function so I know it is working in general. To get the images I do the same as I do in windows. I just use the Sikuli-IDE to take snapshots of the images and then drill into the saved file to copy the image.png file to the folder that I want. However, Eclipse can't seem to find the image files on my Mac.

To give you an example I got a screenshot of the finder button and saved it in the Documents folder. This is my code:

  @Test
  public void testButton() throws FindFailed {
    s.click("/Documents/finder.png", 0);
  }

This works perfectly in Windows (with the right path and image) but in Mac I get the following error:

FindFailed: can not find /Documents/finder.png
Line ?, in File ?
 at org.sikuli.script.Region.handleFindFailed(Region.java:349)
 at org.sikuli.script.Region.wait(Region.java:420)
 at org.sikuli.script.Region.find(Region.java:308)
 at org.sikuli.script.Region.getLocationFromPSRML(Region.java:856)
 at org.sikuli.script.Region.click(Region.java:488)
 at Test_General_Application.testButton(Test_General_Application.java:35)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Vince
Solved:
Last query:
Last reply:
Revision history for this message
Vince (melekal) said :
#1

Still unsure why Mac didn't like my image path. Windows was perfectly fine with them. However, I was able to correct this by just adding a folder in my eclipse called img (to be consistent with everyone else here) and then copied the images in there. Works great now just pointing it to "img/finder.png".

Revision history for this message
Tsung-Hsiang Chang (vgod) said :
#2

The Documents folder is not in the root directory, but your home directory. The path should be "/Users/you-username/Documents".