Assume I want to simulate a login in the display manager to automate a test case. More or less this would mean a tool simulating keystrokes I guess. Is there anything out there?

Options I'm aware of, but I'm not asking for:

  • Disable the login completely using automatic login or password-less login

Using xnee you can do something similar, but sadly does not work fully:

  1. Lock your screen
  2. Run cnee (xnee) on a virtual console CTRL + ALT + F1 to record mouse movements and key strokes: cnee --record --keyboard --mouse --display :0 --out-file login.xnl. This will record mouse movements and key strokes from display :0.
  3. Switching back to X console
  4. Click into the password field, enter password and press RETURN
  5. Switch back to virtual console to stop recording with CTRL + C
  6. Run cnee to replay the captured events cnee --replay --display :0.0 --file login.xnl
  7. Immediately switch back to the X console (otherwise the commands will not be replayed there) You're logged in now.

What finally rendered the solution useless is that you have to switch to the X console, what would need to be automated, too.

1 Answer 1


I guess you want to test the display manager and not automate the login on a physical machine. (By the way I think KDM is dropped with the release of KDE Plasma 5 and now uses SDDM instead since a couple of years.)

One possible way is to use VNC:

  • Start a x11vnc server, which starts the display manager you want to test
  • Connect with a VNC testing framework (for example T-Plan Robot)
  • Run script to sendkeys and verify login

Alternatively check out Sikuli to drive a VM (for example with VirtualBox).

  • Start a VM with the display manager visible
  • Start a Sikuli script on the host computer

Siluki might also work against a physical machine when using xrdp.

  • It's about automating the login on a physical machine as part of a test precondition and it could be part of a test ensuring certain logins exist and work as expected.
    – munro
    Sep 6, 2016 at 10:22
  • Now I think about it shouldn't matter to much. You should be able to run both solutions from a machine against that machine, but I think its easier if you test against a virtualmachine. This would make it scale better to. Sep 6, 2016 at 11:07
  • I'll have a look at it. I also thought about using X forwarding.
    – munro
    Sep 6, 2016 at 11:28
  • With X Forwarding you still have to find a way to drive, maybe xautomation.sourceforge.net works in this case, but I have never tried it. Sep 6, 2016 at 12:10
  • Expecco is available to me -- it should be able to do this (although I have to evaluate). I also found the cnee parameter --display which did the trick. I'll add another answer describing what I did.
    – munro
    Sep 6, 2016 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.