Skip to content

Commit 819b741

Browse files
authored
Updated readme for steps on lockout/disconnect
1 parent 0a3d4a5 commit 819b741

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Docs/RunningOnRemoteMachine.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,21 @@ CalculatorResult = CalculatorSession.findElementByAccessibilityId("CalculatorRes
3333
Therefore we need to follow the below steps on the remote machine for the Windows GUI tests to run in an autonomous fashion :
3434
- **5.1**. Setup Batch file to kill any old instances of WinAppDriver - This will be used in the KILLWAD scheduled task later
3535
- *Name* : kill_winappdriver.bat
36-
- *Contents* : taskkill /im WinAppDriver.exe /f
36+
- *Contents* : `taskkill /im WinAppDriver.exe /f`
3737
- **5.2**. Setup Batch file to start WinAppdriver - This will be used in the StartWAD scheduled task later
3838
- *Name* : LaunchWAD.bat
39-
- *Contents* : cmd start /K "C:/Program Files (x86)/Windows Application Driver/WinAppDriver.exe" 10.x.xx.xx 4723/wd/hub
39+
- *Contents* : `cmd start /K "C:/Program Files (x86)/Windows Application Driver/WinAppDriver.exe" 10.x.xx.xx 4723/wd/hub`
4040
- *Note*: The IP address above (10.x.xx.xx) should be replaced with the local IP address of the server/remote machine
4141
- **5.3**. Setup Batch file to logout (without disconnecting) from the remote machine :
4242
- *Name* : logout-rdp.bat
43-
- *Contents*: for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
44-
%windir%\System32\tscon.exe %%s /dest:console
45-
C:\Install\QRes.exe /x 1920 /y 1080
46-
)
43+
- *Contents*: `for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (%windir%\System32\tscon.exe %%s /dest:console C:\Install\QRes.exe /x 1920 /y 1080)`
4744
- *Note*: When using Remote Desktop to connect to a remote computer, closing Remote Desktop locks out the computer and displays the login screen. In the locked mode, the computer does not have GUI, so any currently running or scheduled GUI tests will fail.
4845
To avoid problems with GUI tests, we use the tscon utility to disconnect from Remote Desktop. tscon returns the control to the original local session on the remote computer, bypassing the logon screen. All programs on the remote computer continue running normally, including GUI tests. Therefore logout-rdp.bat should be exclusively used to logout from the remote machine and the admin user should not logout/disconnect manually from the remote . Also, the resolution is passed as a parameter in the above batch file as 1920x1080
4946
- **5.4** . Setup *Scheduled Tasks* on the target machine to kill Winappdriver (as per the BAT file in 5.1) and to start Winappdriver (as per the BAT file in 5.2) as the target programs. Ideally the Triggers should be *Daily* and *Startup* , so that the scripts running via the Test runner (Ex: JENKINS) , always have an instance of Winappdriver running on the server. These Scheduled Tasks should be setup to run with highest privileges on the machine (as Winappdriver requires to be run with Admin rights)
47+
- **5.5** : Some remote machines or server instances can have a screen lock policy, preventing Winappdriver from interacting with GUI elements. This can be handled via either updating the policy or running a small script as follows :
48+
`Dim objResult
49+
Set objShell = WScript.CreateObject("WScript.Shell")
50+
Do While True
51+
objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}")
52+
Wscript.Sleep (6000)
53+
Loop`

0 commit comments

Comments
 (0)