Java Robot Code does not work when remote desktop window is not active

Go To StackoverFlow.com

3

I'm running some selenium tests on a amazon cloud machine. My web application has a flash area where i'm simulating a keyboard type and click using java robot code (also tried auto it script to simulate user click and type on the flash area) . The code works when i connect to the server using remote desktop and the remote desktop window is active, but when i minimize the remote desktop window, the java robot code does not work?

    Robot robot = new Robot();
    robot.delay(5000);
    robot.mouseMove(400, 400);
    robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
    robot.delay(2000);
    robot.keyPress(KeyEvent.VK_H);
    robot.keyPress(KeyEvent.VK_I);
    robot.keyPress(KeyEvent.VK_SPACE);
    robot.keyPress(KeyEvent.VK_B);
    robot.keyPress(KeyEvent.VK_U);
    robot.keyPress(KeyEvent.VK_D);
    robot.keyPress(KeyEvent.VK_D);
    robot.keyPress(KeyEvent.VK_Y);
2012-04-05 01:52
by Rajesh
Are you sending the key commands remotely? can I ask about the implementation of your remote Robot server? did you create one yourself - Saba Ahang 2014-12-02 07:56


0

I installed UltraVNC Server and connected using VNC client. The problem is not observed and the robot works even after disconnecting. Below is the exact steps:

  1. Login to the remote machine using Windows Remote Desktop tool.
  2. Install UltraVNC server as a Windows service.
  3. Log off from the system (you are still within the remote desktop tool).
  4. Now using VNC viewer, connect to the system.
    You will be shown the login screen. You can login to the system using vnc viewer now.
2012-04-12 14:01
by user1321458
Ads