Page 1 of 1

Desktop Capture

Posted: Sun Apr 14, 2019 10:28 am
by theraviz
Hello,

I want to capture desktop screenshot frequently during my automation execution and save it in a particular folder. My code is all working except the one to capture the desktop which is the below.

Image img = Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Desktop.CaptureImage();
img.Save(_path, System.Drawing.Imaging.ImageFormat.Jpeg);

The first code is not working even though I have added the proper reference. It says

Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITest.Playback, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Is there a way to solve this? Or can you provide me an alternate code just to capture the full desktop?

Thanks in advance

Re: Desktop Capture

Posted: Mon Apr 15, 2019 1:05 pm
by theraviz
This is resolved using bitmap codes from the earlier posts. Thanks