Possible to run Sikuli on a headless machine??

Asked by Will P

Will it ever be possible to run Sikuli on a headless machine, e.g., one without a display attached? This could be useful for instance, running automated UI tests on a continuous build environment where your machines don't typically need to have a display. It might even be useful for running scripts on machines that turn on screensavers, though that might be an entirely separate issue. I'm not too familiar with what hooks are available for the display in the different OS's though, so maybe it's not feasible.

I'm running scripts on Mac OS X, with Sikuli 10.1. Screenshots being captured by Sikuli on headless machines are all black.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Tsung-Hsiang Chang (vgod) said :
#1

It's possible to create a virtual display (e.g. VNC server) and connect Sikuli to that "display". (That is, to replace the java.awt.Robot with a VNC Robot that directly works on a VNC session.) I know a guy who is developing a VNC Robot for Sikuli, and he told me he will submit a patch once he's done. With this VNC Robot, Sikuli should be able to run on a headless machine.

Revision history for this message
Will P (wphan) said :
#2

Just wondering, has there been any update on this task?

We've looked a little at making Sikuli running on computer A connect through vnc to computer B and control computer B. However, we still have a problem if we're trying to run Sikuli directly on computer B but computer B is not connected to a physical monitor -- all screenshots are black, and Sikuli gives errors that it can't detect the pixel format.

Thanks!

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

What's your setup on the computer B? Were you running a VNC server there and somehow using Sikuli to read the pixels from the VNC server directly?

Revision history for this message
Will P (wphan) said :
#4

Computer B is a Mac 10.6 machine running on a rack somewhere. I enabled connecting to the machine by going to System Preferences->Sharing and turning "Screen Sharing" on.

I pushed Sikuli 0.10.2 onto the machine, VNC'ed in, tried to run a script, and got the errors I mentioned above. When I plugged the machine into a kvm, the script succeeded.

Revision history for this message
Will P (wphan) said :
#5

Ah, and also to clarify, the two cases I mentioned above are completely different. I only mentioned the first one because I know you're a little familiar with what we've been doing, and wanted to let you know that this question was different. I only care about the second case.

First case (which I don't care about in this question):
Running Sikuli on computer A. Sikuli connects through VNC to control computer B.

Second case:
VNC to Computer B. Computer B is trying to run Sikuli.

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

I'm not sure how the built-in "Screen Sharing" on Mac works. I guess it didn't open a virtual display but connected to its real desktop instead. So, if you don't have a monitor connected, maybe the real desktop would be just blank. I know that the Linux VNC servers open a new X11 server every time with a VNC session as its display. If you can find this kind of VNC servers on Mac, I think it should work for you.

Revision history for this message
Launchpad Janitor (janitor) said :
#7

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

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

possibilities depend on the concrete situation

Revision history for this message
Zak Lym (zachlym) said :
#9

@RaiMan, Where is the like button for "possibilities depend on the concrete situation" ?

Should I attribute this quote to you when I use? : )

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

@ Zak
We have a like button here: mark the answer that solved your open question. The poster will get a notice that tells him "Thanks, <nickname>, that solved my question".

But in this concrete situation, it was not possible for you, to mark my answer. Sorry, not my responsibility. But feel free, to post a request bug to launchpad for like buttons in comments.

Ok, enough comedy ;-)

I just wanted to reopen the expired question, since it is not in the normal search scope, when marked expired. In the last cases, when I did it with other questions, I mentioned this in the comment. So it gives users a chance to post comments, if they have a solution, new information, ...

Revision history for this message
Randy Koster (randall-koster) said :
#11

My application using Sikulki is running on a Windows 7 virtual PC under Hyper-V. As long as I leave the PC in a signed in state, it finds a virtual head and works just fine.

I did, however, find it problematic accessing this virtual PC using RDP. When running scripts against an IE browser it would behave like the Back button was being pressed, throwing the script off. Running it directly under Hyper-V was problem free.

Revision history for this message
Bartosz Firyn (sarxos) said :
#12

I'm using sikuli-script.jar to run tests in headless environment in Travis CI working on Ubuntu. I noticed few problems with setup but now everything works fine. All details can be found in my github project https://github.com/sarxos/sikuli-ocr

- sudo apt-get update
- sudo apt-get upgrade
- sudo apt-get install libavformat-dev
- sudo apt-get install ffmpeg
- sudo apt-get install libcv2.1
- sudo apt-get install libcvaux2.1
- sudo apt-get install libhighgui2.1
- sudo apt-get install libcv-dev
- sudo apt-get install libcvaux-dev
- sudo apt-get install libhighgui-dev
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- export MAVEN_OPTS=-Dsikuli-script=target/sikuli-script.jar
- mvn test

Revision history for this message
ABET (abetv) said :
#13

I don't see any real solution to this. So does sikuli require the real desktop to be always up and running for sikuli to detect the image? coz I am having this same problem trying to connect to a lab machine (mac and windows). and the screenshots getting captured are blank (if monitor is off) or it somewhat looks like the screensaver.

Revision history for this message
Bartosz Firyn (sarxos) said :
#14

One of my projects where i used Sikuli is a game bot. It was always running - when I gad monitor either turned on or off (Windows XP, SP2, 32-bit). Of course when you have screensaver turned on and you try to take picture with Sikuli, then you will probably get image of this screensaver. I assume that ANY kind of video output is required to run Sikuli - either Desktop on Windows or X process on Linux.

Revision history for this message
amr lotfy (amr-lotfy) said :
#15

Hi there :)

I have successfully got sikuli to work in headless mode (windows and ubuntu) by installing the display driver from virtualbox guest additions on the real machine and using TightVNC to adjust its resolution from another machine and it is working excellent, you can check my answer http://stackoverflow.com/a/26032780/1356559.