RaiMan / SikuliX-2014

SikuliX version 1.1.2 (until February 2018)
http://sikulix.com
805 stars 235 forks source link

Issue with autoscaling (finding images) #265

Open kenorb opened 7 years ago

kenorb commented 7 years ago

I'm testing SikuliX on Mac using VNC client (Sharing Screen). Since full screen is not supported, I need to have a smaller window. The problem is the window can be resized to any size and code detecting the image doesn't work anymore. Once I change the size of the window, I don't know what was the previous size.

So in other words, having this code (image is the screenshot of the visual button):

region.doubleClick("1496324592713.png")

it works for only specific size of windows, but it stops working after slight size changes (the whole screen is scaled differently).

Maybe there is some other way of catching the image features (in case when OCR doesn't work either), I don't know.

What would be the solution to that problem to write more universal code? Especially to avoid retaking and replacing multiple images over again.

glitchassassin commented 7 years ago

You could run Sikuli locally, on the VNC server, so that the client's image manipulation doesn't affect the script. As long as the host resolution itself doesn't change, client-side scaling wouldn't have any effect.

The other option would be to disable client-side scaling in the VNC client. If the VNC host's resolution is larger than the client's screen, you might have scroll bars, but this could be an option depending how much of the screen you need to access.

toschneck commented 7 years ago

@kenorb If you wan't you can run your UI test in a Docker container, where you can specify a fixed Resolution. Basically it's like a VNC server in a container environment. This guarantees that at every run, the UI environment looks the same. See https://github.com/ConSol/docker-headless-vnc-container.

We use this concept to run our Sakuli tests (Web tests combined with Sikuli UI testing) since a while and are very happy with this. If you wan't, take a look at https://github.com/ConSol/sakuli :wink: