Setting image path in SikuliX

    When we set up Sikuli environment, we must ensure that the path where Sikuli is looking for images is set correctly. Sikuli automatically sets the default path as described below. The path is then stored in bundlePath variable and can be set manually to the preferred location.

Java environment (assuming Maven project)

    The folder where the Java project is located.

Default bundlePath within Java environment

    For example, if your project pom.xml is located in C:\workspace\project, then this folder will be set as default bundlePath.

    To obtain what folder the bundlePath is pointing at and to manually set an alternative location, you can use the following commands:


1
2
3
4
System.out.println(ImagePath.getBundlePath()); // print current bundlePath
ImagePath.setBundlePath("src/main/resources/images"); // set custom bundlePath

System.out.println(ImagePath.getBundlePath()); // print new bundlePath

The output will be:

1
2
C:\workspace\test
C:\workspace\test\src\main\resources\images


Python environment
    In Python, the bundlePath will point to the same location as your .py file. So if you run a test from:

C:\SikuliX\Tests\TestPlain.sikuli

this is where the images will be looked for unless it is manually configured to point elsewhere. For example like this:


1
setBundlePath("C:\SikuliX\Tests\Images")

Comments

  1. You are providing a post that is very useful for developing my knowledge and I learn more info from your blog.
    Blue Prism Online Course

    ReplyDelete

Post a Comment