I am doing all the work remotely on my Windows 10 Virtual Machine (Via RDP). Whenever I am logged in to the server, I can see my automation running fine but when I close my RDP connection, the WinAppDriver can’t find the elements on the desktop application and thus it stops working.
How can I solve it? Please let me know If I am missing something.
When you disconnect the RDP session windows knows it doesn’t have the render the gui, so it doesn’t.
The trick is to disconnect a different way. Terminate your connection from the remote sever with this:
%windir%System32tscon.exe RDP-Tcp#NNN /dest:console
where RDP-Tcp#NNN is the ID of your current Remote Desktop session, for example, RDP-Tcp#5. You can see it in the Windows Task Manager on the Users tab, in the Session column.
If you need more info have a look at this site https://support.smartbear.com/testcomplete/docs/testing-with/running/via-rdp/keeping-computer-unlocked.html
The link is for test complete not selenium but the steps are sound.