This is a migrated thread and some comments may be shown as answers.

ActiveBrowser.Capture produces black image if screen is not visible

1 Answer 190 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Hussam Zawil
Top achievements
Rank 1
Hussam Zawil asked on 25 Jul 2011, 04:54 PM
I'm using the latest Telerik WebAii Testing Framework (2011_2_712). Our automation code uses ActiveBrowser.Capture to capture an
image of the browser if the test fails. Our automation uses multiple windowless clients VMs (Windows Server 2008 R2 Standard).
If I remote desktop into these VMs to view the browser window while tests are running, ActiveBrowser.Capture works fine and produces the correct image. However, if I do not remote desktop into the machine and ensure that the browser running the tests is visible, or minimize the remote desktop window, then a black image is always produced.  I even tried doing multiple calls to ActiveBrowser.Capture  with a 1 sec delay between them as recommended by some posts and saving the image into different formats (jpeg, gif, bmp, png) but they all produced black image.

I saw many posts regarding this problem and it is due to older versions of WebAii framework using the Windows screenshot to capture an image and that requires the browser to be visible. I thought that the latest release fixed that, but apparently not.

Here is the code I'm using:
                ActiveBrowser.Window.SetActive();
                ActiveBrowser.Window.SetFocus();
                System.Drawing.Bitmap browserImage = ActiveBrowser.Capture();
                if (browserImage != null)
                {
                    var fileName = TestCaseName + "_" + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss_ffff");
                    fileName = Path.ChangeExtension(Path.Combine(directory.FullName, fileName), ".png");
                    browserImage.Save(fileName, ImageFormat.Png);
                }

Is there any other suggestions I can do to make this work? Keeping active Remote Desktop Connections to each client VM is not an option. I've attached a sample image of the black capture of browser.
Thanks for any help you can provide.

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 27 Jul 2011, 11:27 PM
Hi Hussam Zawil,

I've heard of some customers having success using a VNC product instead of using Remote Desktop. I don't have a specific one to recommend, but there are multiple VNC products available on the market today.

I have filed a bug report on this here.

All the best,
Cody
the Telerik team
Check out the Test Studio roadmap to find out more about the new performance testing functionality coming in our R2 2011 release this September!

Have you looked at the new Online User Guide for Telerik Test Studio?
Tags
General Discussions
Asked by
Hussam Zawil
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or