can we execute QTP script on remote machine by keeping session minimized - automation

I have couple of machines on which I wish to schedule exceutions. I need to access these machines remotely for exceution. Whenever I start exceution from these machines and minimize the session my script fails. So just curious to know whether QTP scripts can be executed while keeping sessions minimized. If yes what changes needs to be made in script. Thanks.

When you minimize this window, the operating system switches the remote session to a GUI-less mode and does not display windows and controls. As a result, the tests are unable to interact with the tested application’s GUI as the GUI doesn’t actually exist in this case.
You need to change Registry keys on your computer (that is, the computer from which you connect to a remote QTP workstation). Here is a step-by-step description:
Close Remote Desktop sessions opened on your computer.
Click Start and select Run. In the Run dialog box, type regedit and press Enter. Registry Editor starts
Locate any of the following Registry keys:
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\
(if you want to change the RDC settings for your user account)
-- or --
HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client\
(if you want to change the RDC settings for all accounts)
Create a new DWORD value in this key named RemoteDesktop_SuppressWhenMinimized. Specify 2 as the value data.
That’s all. Now minimizing the Remote Desktop Connection window on your computer will not affect the remote computer’s GUI and the GUI will still be available to your automated GUI tests.
This was taken from: http://blog.smartbear.com/post/10-10-11/testcomplete-tip-running-tests-in-minimized-remote-desktop-windows/

The problem you're facing is that if you minimize your display the remove machine knows that it doesn't have a display and ignores any questions about control locations and requests to move the mouse. In some cases QTP runs tests using device replay which means that the test will fail.
To work around this you need to have the remote machine think that it still has someone attached to it. One way is (obviously) to not minimize or close the remote desktop session. Another way is to use a remote access program that doesn't inform the remote machine when it's minimized a free example of such program is VNC, if I remember correctly you can even close the VNC session (not just minimize it) and the test will still run successfully.

Related

Is it possible to run UFT scripts on virtual machines?

I am writing scripts which will install UFT and do all the configuration setting require to run the UFT scripts. My UFT scripts are browsing some urls etc.
I want to know if I do it in Virutal Machines then is it possible to run the UFT scripts on those servers as they won't have mouse and keyboards attached.
Want to run automatically on machines without logging into the machines.
In case if you are simulating mouse & keyboard actions (like hitting ENTER, Clicking on particular coordinate etc) in your script, It will work fine even if mouse and keyboards are not connected to a computer. Basically you are simulating mouse and keyboard clicks w/o actually using them.I assume you have verified your scripts in your local machine. If it works fine, Then it will also work fine in your VM.(assuming your VM has enough permissions/all the prerequisites installed/configured etc).
It works. I use it every day. You can even use analog recording in the VM with a Remote Connection to the VM with no problems as well.

Running Hub and Nodes remotely on Windows without a user logged into the machine

Selenium GRID2 is setup with a hub and three nodes (VMs Windows). All the config files are set and I start the services with a couple batch files executed on each machine. Once everything is started up it works great. When the remotely connected user who executed the batch files actually logs out of the machine the tests fail to connect to the browsers anymore.
I could leave the user account logged on after starting everything and just stay logged on. However, I would much rather find a way to get the services to startup and stay active without any user logged on the systems. Is there a way to force all the services to stay active after all users logout of the machine. Also need the full browser to function as there are screenshots as well. Could someone point me in the right direction or tell me how to get that to work or if it's possible?
Setup a scheduled task via Task Scheduler to execute the batch files to start the node on each machine. You can set a trigger to execute the batch file on system startup, or at a specific time.
Also, when creating the task, select the option "Run whether user is logged on or not"
I also add a task to restart the node machines (every night) to keep it clean of stale browser windows.Since the node batch files runs at startup, you do not need to login to the hub/node machine to start it manually.

How to get data out of citrix

Here's what I want to be able to do:
Run a program on my local computer which logs in to a citrix server (using citrix receiver or doing so in a similar way), on the server in the citrix session open a web browser, load a website, and then bring the html of that site back out of the citrix session and onto my local computer. Bascially I want to get data out of a citrix remote session.
How can I do this programmatically?
I'm fine with whatever programming language/modality you are comfortable in answering the question using.
I've looked a little into the citrix apis but while I find some things about logging in and even sending keystrokes and mouse clicks I found nothing about obtaining data. I could just log in and then use a program like wireshark to get the information, but I'm guessing it's all encrypted (plus then I wouldn't be doing my task all programmatically). I know of at least one open source program which seems to be able to replace a citrix reciever/client (openthinclient.org) but before I got digging through all its source code to try to answer my question I thought I'd ask here in case someone had an easier answer.
If all you want is to automate the task, is having the program act as a citrix client necessary?
I assume you don't have install privileges inside your citrix session, so are unable to install one of the many automation tools available (such as http://docs.seleniumhq.org/)?
Given the above...
If you have/allow java on your local machine, have a look at http://www.sikuli.org/
The main difference between this and other automation tools I've come across is that Sikuli uses the image on screen to navigate the gui, rather than grabbing calls to the widgets (which wont work in a citrix session).
So, assuming you can take a screenshot of your citrix session, it could be useful to you.

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);
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.
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:
Login to the remote machine using Windows Remote Desktop tool.
Install UltraVNC server as a Windows service.
Log off from the system (you are still within the remote desktop tool).
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.
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

Testing install procedure of a program requiring administrative privileges

I'm trying to write automated test, to ensure that the installer for my program works okay.
The program can be installed for all users (requires admin privs), or for current user (does not require admin privs). The program can also autoupdate itself, which in some cases requires admin privileges, and in some cases doesn't.
I'm looking for a way where I can have an automated test click "Yes, Allow" on the UAC dialogs, so I can write tests for all different scenarios, on many different operating systems, so that I can be confident when I make changes to the installer that I didn't break anything.
Obviously, the installer process itself cannot do this. However, I control the complete machine, and could easily start some sort of daemon process with administrative rights, that the testprogram could make a socket connection to, to request it to "please click ok on the UAC now".
I actually figured out how to do this while looking to answer a similar question about UAC. Here is what you can do:
Write a service that runs as SYSTEM.
Open the process token of the winlogon.exe instance running in your logon session.
Use that token to launch a helper process on the Winlogon desktop via CreateProcessAsUser.
At this point, you have a helper process running as SYSTEM in your logon session on the Winlogon (secure) desktop. From here you can use some kind of IPC mechanism to communicate from your automated test program to the helper process. In the helper process you can EnumDesktopWindows to find the UAC prompt. This is as far as I took it; I didn't actually try to simulate clicking Yes or No, but I don't see any reason why it wouldn't work. Also, I only tested on Windows 7 32-bit; I believe the UAC architecture is identical to Vista, but I didn't test on it.
It took me a while to figure all this out; I can provide some code if you want.
EDIT: Just as a follow up I added code to use FindWindow() to find the "Yes" button and I was able to successfully send it a BM_CLICK message; the UAC prompt went away and the application was allowed to run.
An alternative solution might be to turn UAC off
The least bad solution I've found so far is to run the tests in a VMWare session, and control the mouse/keyboard trough the vmware sdk. Would love to hear about other solutions
Remote Desktop to it or run it as a guest VM (using Virtual PC or whatever, just don't boot to it.) This is also the best way to take a screenshot or video of the UAC prompt.