I ran into an issue while using the Microsoft WebDriver (for Edge) where if there was no RDP session, then the tests would fail and throw an exception that Selenium couldn’t get the window handle after opening the browser. Official issue ticket logged here.
Credit goes to Olena F. from the same issue ticket linked above.
- RDP into your Grid Node
- Open cmd
qwinstaand press [Enter]
- Get the ID of the current RDP process
- Create a .bat file with the following content:
%windir%\system32\tscon.exe # /dest:console
#with the ID from step 4
- On the desktop, create a shortcut to you .bat file
- Right-click on the shortcut and select “Properties”
- Select “Advanced…”
- Select “Run as administrator”
- Select “OK” to close the Advanced options window
- Select “OK” to close the Properties window
- Double-click the shortcut
- You will be kicked of the machine if it works
Note: The script to start the node (covered in this post) will need to be ran while you have control of the RDP session.