4
votes

I do switch often between my laptop screen and my external 24 inch monitor, and I did notice that if I take snapshots on my laptop, then if I run the script while connected to the 24 inch monitor, the test does not work correctly anymore. Same if I go the other way around, taking snapshots from the 24 inch monitor, and then run the test on the laptop monitor.

I believe this is due to the different resolution of the image; is there a way to be "resolution independent" while running Sikuli ? I did consider taking snapshots at different resolution and place everything in a list, then parse the list one element at time, until I find a match; but I hope there is a more efficient way.

1
I wrote a short article going through few possible reasons why this could be happening and what could be done to solve it. eugenesautomation.blogspot.com.au/2016/05/…Eugene S
Thanks Eugene; sadly I did try the similarity value and it does work at random; sometimes it recognize it, sometimes it doesn't, while switching between the big and small monitor. I am running Sikuli on OSX, so I do not have neither clear type font settings nor other visual settings as mentioned in your blog post. I can only assume that going from a 15 inches to a 24 inches monitor, switch implicitly also the resolution from 1440x900 to 1080p :(user393267
Yes, in that case there is nothing much you can do about it. Similarity value can be helpful in certain scenarios when only minor differences prevent proper pattern detection. Lowering it too much will cause chaotic behavior as you observed yourself. Unfortunately, the only solution that will be robust enough is to have 2 sets of patterns for different resolutions/systems.Eugene S
It is as I thought then; thanks for validating my theory. Would be nice if Sikuli could include a scaling parameter that would be used in the comparison algorithm, to offset the similarity.user393267

1 Answers

3
votes

There are few thing you can try (more details here):

  1. Switch ClearType off (only for Windows)
  2. Reduce similarity score
  3. Turn off "Smooth screen fonts edges" (only for Windows)

If the above not helpful then not much can be done in terms of configuration. The only robust solution is to maintain multiple sets of patterns, specific to each system.