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:
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.
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.