Steps to reproduce
- Open a remote desktop
- Run selenium tests on the Remote desktop which have codes to capture screenshot as below and Disconnect Remote desktop from Host machine
Screenshot getScreen = ((ITakesScreenshot)driver).GetScreenshot();
- Re connect to remote after test execution and verify the screenshots captured
Expected Result : Exact screenshot should be captured
Actual Result : Blank screenshots are getting
Other browsers like Chrome, Firefox and IE are able to capture correct screenshot on this context
Comments and activity
- Microsoft Edge Team
Changed Assigned To to “Steven K.”
I was able to repro this even without using RDP, see the attached output file. Have you run this locally?
Also, have you tried this with any other languages besides C#?
Appreciate the submission,
I did a little more research and testing on this and discovered that adding a Thread.Sleep() corrected the issue for me. Can you try the same test and let me know?
Screenshot getScreen = ((ITakesScreenshotdriver).GetScreenshot();
When i run locally it is able to capture correct screenshot, but it always creates blank screen when run on a remote desktop and disconnected it. Tried with "Thred.sleep()" and still blank screens are getting on Remote desktop
Attached screenshots captured when Remote desktop connected and disconnected.
At the moment i don’t have any setup to run on java or any other languages other than C#.
Any fix for this would be a great help
Thank you for the update. Using another language is not required, just curious, in case the issue is related to the language binding. I am also testing with Java.
I test locally first to make sure it isn’t a basic use case issue. I will test using RDP.
Can you give me information on your power configuration for the remote system? for example, is the system set to hybernate or sleep after so many minutes?
You can use Windows Settings GUI to get this or using powershell.
There are also two reports that can be collected.
I could collect log using “powercfg -Query” and the same is attched for your reference.
While trying other two reports i am getting error “This command requires administrator privileges and must be executed from an elevated command prompt.” though i have administrator privilage
This could be because of the default powershell folder is C:\Windows\system32. Can you try running the command in your home or Documents directory?
If that doesn’t work, check your ExecutionPolicy and set it temporarily to ByPass and run again.
Set-ExecutionPolicy -ExecutionPolicy ByPass
Forgot to ask if you are using the default Windows RDP client? Also, what is the version of Windows 10 on the remote test machine? Is the remote machine a physical computer or a VM?
How is the remote machine connected to the network? E.g. Ethernet or Wifi?
The remote machine is on AC Power?
Subgroup GUID: 19cbb8fa-5279-450e-9fac-8a3d5fedd0c1 (Wireless Adapter Settings)
Power Setting GUID: 12bbebe6-58d6-4636-95bb-3217ef867c1a (Power Saving Mode)
Possible Setting Index: 000
Possible Setting Friendly Name: Maximum Performance
Possible Setting Index: 001
Possible Setting Friendly Name: Low Power Saving
Possible Setting Index: 002
Possible Setting Friendly Name: Medium Power Saving
Possible Setting Index: 003
Possible Setting Friendly Name: Maximum Power Saving
Current AC Power Setting Index: 0x00000000
Current DC Power Setting Index: 0x00000002
I am using default windows RDP client.
Version 1703(OS Build 15063.608).
Remote machine is a physical computer and is connected to network by Ethernet.
Steven, just curious to know, why only Edge webdriver has these much dependencies like power configurations and all. It is able to get screenshots in this case using Chrome, Firefox and IE web drivers :(
Well… because I didn’t think that through very well. :-/
So great point. I was trying to figure out why it is happening for you on an RDP session for a physical machine and not happening for an RDP session for a VM/Hyper-V session, i.e. that is how I have been testing.
I need to reproduce this issue to get is worked on. I will run on a physical machine using RDP. Appreciate the help and gentle logic feedback. :-)
Having the same issue with but with Internet Explorer.
On Remote Desktop, the screenshots works fine with Chrome & Firefox, but provides Black screenshots with Internet Explorer.
It’s bcoz once screen gets locked, Windows machine not allowed you to take screen shots on IE browser.
You have to keep widows session active even after getting disconnected from RDP client.
Please keep below commands in a batch file and run to disconnect from RDP client so your current session will unlocked.
C:\Windows\System32\tscon.exe rdp-tcp#1 /dest:console
QRes.exe /x 1920 /y 1080
NOTE: U can check this issue by connecting to your Windows machine through RDP client and execute then u’ll get actual screenshots. Again execute same script after disconnecting from RDP client, now u’ll get blank screen shots.