[HowTo] Running sikuli script on different machines - image search fails

Asked by Prabhat Saxena

----------------- reasons, pitfalls and rules

Based on how SikuliX works:
http://sikulix-2014.readthedocs.io/en/latest/basicinfo.html#sikulix-how-does-it-find-images-on-the-screen

the only conditions needed, to be able to use the same images on other machines:
- the image must be present in a screenshot on the other machines in the same size (width x height) measured in pixels
- and the pixels must have the same content (to a high degree at least)

The first condition is usually met, if screen dimension measured in pixels and the resulting rendering has the same width-height-ratio as the original system. Though depending on resolution (dpi), the images might look smaller or larger, but are found by SikuliX.

The second condition depends on several aspects of the other system:
- if GUI-themes differ at the pixel level (colors, edges, button-design, ...)
- if apps like browsers do a different rendering on other machines
- other aspects, that influence, how something is displayed on a screen at the pixel level (e.g. anti-aliasing with fonts, ...)

So if you plan to use the same image set on different machines, just decide for a few base images, that are used for a compatibility test, before running into problems with a complex workflow, that is not designed to handle not-found-situations, that are caused by incompatible rendering.

In the worst case, you have to be prepared to recapture your images on the other machines and work with image sets, that are switched according to the situation on the current machine.

... and obey the "Golden Rule" of SikuliX:
A capture should have as little background at the edges as possible (less than 20% counted in pixels) and should concentrate on the unique aspects of the image.

-----------------------------------------------------

Why sikuli script fail when I run it on different machines? Does running it on big monitors or small monitors create any difference?

More Details:

I have integrated sikuli with Eclipse and used the Screen class to automate my application.

Kindly help.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
RaiMan Edit question
Last query:
Last reply:
Revision history for this message
Roman Podolyan (podolyan-roman) said :
#1

> Does running it on big monitors or small monitors create any difference?

Yes. AFAIK screen density (DPI) matters (and AFAIR it was answered dozens of times on this forum).

If screens have close size and DPI, scripts run OK on both machines (I can run same script with same images on my working MacBook and remote Mac Mini). If they differ considerably, you better set up VNC to do all work with script on remote machine (or develop some solution which could take different images and choose right set at start).

Revision history for this message
Prabhat Saxena (prabhats) said :
#2

Thanks for your quick reply!!!

If screens have close size and DPI, scripts run OK on both machines?

-> How this can be done? It will be great help if you help me in running my scripts on different machines

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Based on how SikuliX works:
http://sikulix-2014.readthedocs.io/en/latest/basicinfo.html#sikulix-how-does-it-find-images-on-the-screen

the only condition needed, to be able to use the same images on other machines:
- the image must be present in a screenshot on the other machines in the same size (width x height) measured in pixels
- and the pixels must have the same content (to a high degree at least)

The first condition is usually met, if screen dimension measured in pixels and the resulting rendering has the same width-height-ratio as the original system. Though depending on resolution (dpi), the images might look smaller or larger, but are found by SikuliX.

The second condition depends on several aspects of the other system:
- if GUI-themes differ at the pixel level (colors, edges, button-design, ...)
- if apps like browsers do a different rendering on other machines
- other aspects, that influence, how something is displayed on a screen at the pixel level (e.g. anti-aliasing with fonts, ...)

So if you plan to use the same image set on different machines, just decide for a few base images, that are used for a compatibility test, before running into problems with a complex workflow, that is not designed to handle not-found-situations, that are caused by incompatible rendering.

In the worst case, you have to be prepared to recapture your images on the other machines and work with image sets, that are switched according to the situation on the current machine.

... and obey the "Golden Rule" of SikuliX:
A capture should have as little background at the edges as possible (less than 20% counted in pixels) and should concentrate on the unique aspects of the image.

Can you help with this problem?

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

To post a message you must log in.