Issue: - How to run uninterrupted test automation on the remote machine during remote disconnection?
Platform
Opkey On-Premise and SaaS.
Solution
It’s usually seen that while running test automation with Internet Explorer on a remote computer, execution gets failed when users lock their PC or disconnect the remote computer connection. When the remote computer gets disconnected or locked anyway, the graphical user interface disappears and the logon screen appears. It causes interruption for running test automation with Internet Explorer on a remote computer and the user gets failed result.
Now, such problems can be resolved by following a few recommended steps:
You can use “tscon” utility; which enables you to return your control over the remote computer to the original local computer by bypassing the logon screen which usually appears on a locked computer. In this way, your test automation execution with IE and other running programs will run normally and there will also be no interruption. As an administrator, you need to run the following command on the remote computer:
%windir%System32tscon.exe RDP-Tcp#NNN /dest:consoleHere, RDP-Tcp#NNN is the ID of your current Remote computer session. For example, RDP-Tcp#0, RDP-Tcp#1, RDP-Tcp#2, RDP-Tcp#3, etc. You can see it in the Windows Task Manager on the Users tab, in the Session column. Now, you come across a message that “Your remote desktop session has ended” and the Remote computer client gets closed but your test automation along with all other programs and tests on the Remote computer are running normally.
Another way is to automate the disconnection process using a batch file. Create a batch file on a Remote computer by using the following code:
for /f “skip=1 tokens=3” %%s in (‘query user %USERNAME%’) do (%windir%System32tscon.exe %%s /dest:console)
Create a desktop shortcut of this file in the following way:
1. Right-click the batch file > select Send to Desktop (create shortcut).
2. Go to the properties of that created shortcut > click Advanced > select Run as administrator.
Now, you can use this shortcut on the Remote computer when you need to disconnect from the Remote computer. For this, double-click this shortcut on the remote computer in the Remote computer window. In addition, you can also run this batch file at the start of your tests on a Remote computer. You must ensure that you have Administrator rights on the Remote computer. Note:“tscon” command utility is used to release control over the Remote computer and leave the Remote computer unlocked but it reduces system security. You can lock the Remote computer when your test automation is over by using the following command:Rundll32.exe user32.dll, LockWorkStation
Summary: You should not lock or disconnect the Remote computer when your test automation is still running. In case of an un-avoidance situation of locking or disconnecting a Remote computer, you must ensure the hassle-free running of test automation by using the above-mentioned methods.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article