Getting blank screenshot on selenium microsoft edge browser while running a test on a remote desktop

Issue #13721229 • Assigned to Steven K.

Details

Author
shaaz P.
Created
Sep 13, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

  1. Open a remote desktop
  2. 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();
    getScreen.SaveAsFile(Path, ScreenshotImageFormat.Png);
  3. 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

Attachments

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Steven K.”

  • Hi Shaaz,

    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,

    Steve

  • 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?

                Thread.Sleep(3000);
                Screenshot getScreen = ((ITakesScreenshotdriver).GetScreenshot();
                getScreen.SaveAsFile(path, ScreenshotImageFormat.Png);
                Thread.Sleep(3000);

  • Hi Steven,
    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.

    powercfg -Query

    There are also two reports that can be collected.

    powercfg /SYSTEMSLEEPDIAGNOSTICS
    powercfg /SYSTEMPOWERREPORT

  • 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?

    cd C:\Users<your_username>\Documents
    powercfg /SYSTEMSLEEPDIAGNOSTICS

    If that doesn’t work, check your ExecutionPolicy and set it temporarily to ByPass and run again.

    Get-ExecutionPolicy -List
    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.  :-)

    Steve

You need to sign in to your Microsoft account to add a comment.

Sign in