Rajesh
Rajesh

Reputation: 773

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

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);

Upvotes: 3

Views: 3339

Answers (3)

Buddhika
Buddhika

Reputation: 627

Thanks, Daniel,

This resolved the issue we had while running a Synthetic Scenario where we need to use Robot Framework to perform some mouse clicks while the RDP Session is minimized.

Best Regards, Buddhika.

Germain UX: Custom Insights, Alerts, and Automation platform to improve User Experience

Upvotes: 0

Daniel Mascarenhas
Daniel Mascarenhas

Reputation: 11

Issue is not with the scripts, but with the host machine's GUI settings for remote machine. To fix this, perform the following steps on the computer from which you are connecting to a remote workstation :

Configuration for current user only:

Run the regedit.exe tool.

Find the registry key HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client.

Create a DWORD value with the name RemoteDesktop_SuppressWhenMinimized and set its value to 2.

Now find the registry key HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Terminal Server Client. Create a DWORD value with the name RemoteDesktop_SuppressWhenMinimized and set its value to 2.

Close the regedit.exe tool.

Configuration for all users:

Run the regedit.exe tool.

Find the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client.

Create a DWORD value with the name RemoteDesktop_SuppressWhenMinimized and set its value to 2.

Find the registry key HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Terminal Server Client. Create a DWORD value with the name RemoteDesktop_SuppressWhenMinimized and set its value to 2.

Close the regedit.exe tool.

Now when you minimize the Remote Desktop Connection window on your computer, this will not affect the remote computer’s GUI and the GUI will be available to your interactive tasks.

Upvotes: 1

user1321458
user1321458

Reputation: 1

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.

Upvotes: 0

Related Questions