I understand you are having problems with performing UI tests on a EC2 Instance via Selenium.
I did some research on the articles you linked in your post. It seems that some users experienced mixed results from the solutions posted.
I did some general research on Selenium and how others have tried tackling the problem outside of AWS. Other people are experiencing the same frustrations as you, and are also experiencing mixed results. Because of this, I do not think this is an AWS-specific issue.
I looked for a definitive answer and seem to have found one in a Stack Overflow article , which uses an Azure VM. This is what I found:
- This is a limitation with Windows since it uses RDP (or VNC, etc) to set the screen resolution.
- It is not currently possible to change the resolution of a Windows instance unless you use RDP or a test agent.
- This is likely due to a device <-> driver issue on windows
There are workarounds available.
I found an article that some users were using for workarounds to perform their UI tests. It suggests automating RDP sessions to set the resolution (in your case, an EC2 instance) for the UI test .
 Increase the screen resolution on Test Agent - Stack Overflow (https://stackoverflow.com/questions/45829787/increase-the-screen-resolution-on-test-agent)
 Automate your remote desktop sessions - OutOfMemoryException (https://outofmemoryexception.wordpress.com/2016/03/29/automate-your-remote-desktop-sessions/)
Please let me know if this response helps or if you have any other questions. If the above steps do not resolve your issue, I strongly encourage you to contact an AWS support engineer who will be able to assist you.
Password Change in RDPasked 12 days ago
Unable to RDP into Windows Instanceasked 3 years ago
Windows Server RDP errorasked 6 months ago
EC2 instance inaccessible after RDP changeasked 2 years ago
How to change default Windows resolution? (Autologon resolution without active rdp session, e.g. for UI test automation with selenium)asked 7 months ago
Default Password for Lightsail Windows Serverasked 4 months ago
Screen Resolution Windows Instanceasked 3 years ago
If we provision an EC2 windows Instance, will it includes the windows license by default? what are the licensing types available from AWSAccepted Answerasked 6 months ago
Autoscaling windows ec2 and autojoin to domainAccepted Answerasked 2 years ago
Default display resolution (Windows ec2 server)asked 2 years ago