- Newest
- Most votes
- Most comments
The issue you're experiencing with pyautogui not working when the RDP connection is minimized or closed is related to how Windows handles display and input when there's no active RDP session. This is a common challenge when running UI automation tools like pyautogui on remote Windows servers.
The root cause is that Windows changes the display settings and input handling when there's no active RDP session, which affects tools that rely on screen interaction like pyautogui.
To address this problem, you need to configure the Windows server to maintain a consistent display resolution and input handling, even when there's no active RDP session. Here are some potential solutions:
-
Use a virtual display adapter: Install a virtual display adapter driver on the Windows server. This will create a persistent "fake" display that pyautogui can interact with, even when no RDP session is active.
-
Configure autologon: Set up Windows autologon to ensure there's always an active user session, even when no one is actively connected via RDP.
-
Use remote control software: Instead of RDP, consider using remote control software that doesn't affect the server's display settings when disconnected.
-
Adjust Windows settings: Try modifying Windows settings to maintain a consistent resolution and display configuration, regardless of RDP connection status. This may involve registry changes or group policy adjustments.
-
Use alternative automation methods: Consider using tools that don't rely on screen interaction, such as Selenium's headless mode or other API-based automation approaches.
If these solutions don't resolve the issue, you may need to explore more advanced options or consider redesigning your automation approach to work within the constraints of remote Windows server environments.
Sources
How to change default Windows resolution? (Autologon resolution without active rdp session, e.g. for UI test automation with selenium) | AWS re:Post
Free EC2 doesn't work | AWS re:Post
To add to rePost agent answer, you probably need to configure a higher default screen resolution, enable Windows autologon, and configure pyautogui to run on Windows startup. You may have to disable windows screen lock and monitor screen off.
Try the guidance in this article, and connect using DCV.
Relevant content
- asked 2 years ago
- asked 9 months ago
- asked 4 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 6 months ago