Hello,
I haven't found the same situation on the forum.
My scenario is the following one:
In a certain step of my web Automation Test, I need to capture what I am seeing on the web page. That's why I am using the GetBitmap() method.
Most of the times it works but sometimes, I don't know the reason, I get a blank content instead of what I am actually seeing. (Image attached)
Here is my code (is still a work in progress as I haven't made this work perfectly)
System.Drawing.Bitmap browserImage = null;
try
{
Manager.ActiveBrowser.RefreshDomTree();
Manager.ActiveBrowser.WaitUntilReady();
ActiveBrowser.Window.Show();
Manager.ActiveBrowser.Window.WaitForVisibility(true, 5000);
ActiveBrowser.Window.SetActive();
ActiveBrowser.Window.SetFocus();
//Operar sobre la Tabla para ver si con esto se fuerza que tenga el foco aquĆ
Pages.Atenea0.Table.Focus();
Pages.Atenea0.Table.Click();
ActiveBrowser.ContentWindow.Show();
ActiveBrowser.ContentWindow.SetActive();
ActiveBrowser.ContentWindow.SetFocus();
browserImage = ActiveBrowser.ContentWindow.GetBitmap();
if (browserImage == null)
{
ActiveBrowser.Window.RefreshChildren();
ActiveBrowser.ContentWindow.Show();
ActiveBrowser.ContentWindow.SetActive();
ActiveBrowser.ContentWindow.SetFocus();
browserImage = ActiveBrowser.ContentWindow.GetBitmap();
}
if (browserImage == null)
{
browserImage = ActiveBrowser.Capture();
}
I am a little bit lost as I said most of the times works but it's not acceptable for my goal to have something that randomly fails.
I hope you can help me with this.
Regards,
Sebastian