WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

How to run win app driver desktop tests remotely

Open samkhayal opened this issue 4 years ago • 13 comments

HI Guys,

I have created a small automated script using winappdriver to run and test a desktop application. i have installed a copy of this framework on 2 different vm's. is there a way i can control and run those tests remotely from my local ? without having to connect to vm and run the test from nunit console or visualstudio ? i know there is an issue with having an active remote session but if i resolve this by automating the process to connect to vm is there away to launch it remotely ?

samkhayal avatar Aug 03 '20 19:08 samkhayal

You can write a small batch file and using the task scheduler can launch the automation other option would be to use Azure pipleline for your tests.

anunay1 avatar Aug 04 '20 08:08 anunay1

@anunay1 : We tried creating the Task scheduler for our Jenkins job, but since it doesn’t open Winappdriver in Interactive mode, hence the approach failed

smilinrobin avatar Nov 06 '20 04:11 smilinrobin

@samkhayal - We were able to configure WAD on remote using instructions here : https://github.com/microsoft/WinAppDriver/pull/1368

smilinrobin avatar Nov 17 '20 08:11 smilinrobin

Hello everyone, I don't know if others have finally found the solution. My case I use Jenkins to launch the run i.e. my desktop application which is in a VM. All works when the session is not locked. But once locked, the display scripts pass (System.out.println) and even the winappdriver launches correctly, however I can't click on the elements. Could you please help me.

MamadouAlphaDiallo avatar Apr 05 '22 09:04 MamadouAlphaDiallo

@MamadouAlphaDiallo - You can find the solution which worked for us here : https://github.com/microsoft/WinAppDriver/blob/819b7416c5e2081bedfce34861316776b8d28d36/Docs/RunningOnRemoteMachine.md

smilinrobin avatar Apr 05 '22 11:04 smilinrobin

@smilinrobin Thank you for your feedback, I would like to know did you have a problem initializing the driver with your IP address because I am stuck at this stage. WinAppDriver.exe 192.88.X.X 4723/wd/hub With this error message

Error adding url to url group Failed to initialize: 0x80004005

MamadouAlphaDiallo avatar Apr 05 '22 14:04 MamadouAlphaDiallo

We did not face that error after configuring the firewall rules.

smilinrobin avatar Apr 05 '22 17:04 smilinrobin

Hello @smilinrobin, it worked for me too. Thank you very much

MamadouAlphaDiallo avatar Apr 11 '22 15:04 MamadouAlphaDiallo

Wow , awesome @MamadouAlphaDiallo . Did you have to do any extra configurations ?

smilinrobin avatar Apr 11 '22 16:04 smilinrobin

Hello @smilinrobin, I think I rejoiced so quickly. Because this morning I see that: When my session is closed beyond 1 hour and I launch my tests, No interaction so my tests fail. On the other hand, when my session is closed for less than an hour, and I restart my tests, it works correctly. For configuration nothing special: In Jenkins I just put batch scripts Each launch of the jenkins run:

Before maven run 1 - SCHTASKS.EXE /RUN /TN "RunWD" 2 - cmdkey /generic:TERMSRV/Hostname/user:${user} /pass:${pass} 3 - cmdkey /delete:TERMSRV/Hostname

After maven run 4- SCHTASKS.EXE /End /TN "StartTestSession"

Without forgetting the logout-rdp batch script (run with admin) Configuration: General Run only when user is logged on. Trigers Begin the task: On disconnect from user session

For my part, the WAD taskill I do it daily at 8 a.m. (When there is no one performing) and 1 p.m. (for the moment at the break) Note: user and pass which is just specific to my application.

Correct me if I'm wrong.

MamadouAlphaDiallo avatar Apr 12 '22 06:04 MamadouAlphaDiallo

@MamadouAlphaDiallo - If you see multiple issues with WinAppDriver , you can even try out : https://github.com/karatelabs/karate/tree/master/karate-robot . They have active community support as well.

smilinrobin avatar Apr 12 '22 10:04 smilinrobin

@smilinrobin Thank you for the link

MamadouAlphaDiallo avatar Apr 14 '22 14:04 MamadouAlphaDiallo

Hello @smilinrobin sorry to bother you I come back to this problem after a break. I wanted to know how do you configure with the task scheduler logout-rdp.bat because I tried after creating the task: Trigger:

  • On disconnect for user session
  • On workstation lock But still a problem. And possibly Dim objResult Set objShell = WScript.CreateObject("WScript.Shell") Do While True objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}") Wscript.Sleep(6000) Loop

with which trigger it is triggered. thanks in advance

MamadouAlphaDiallo avatar Jun 17 '22 08:06 MamadouAlphaDiallo