¿Cómo verificar que el documento del navegador web esté completamente cargado?
Frecuentes
Visto 2,958 veces
1
I have a application which loads iframes dynamically when the page is loaded. When I do automation of that application with Web browser control, I am getting script error, because the java script is not fully loaded in the iframe.
I am checking the ready state of the browser in DocumentCompleted event, still no luck...
if (this.browser.ReadyState != System.Windows.Forms.WebBrowserReadyState.Complete)
return;
else
{
// do automation
}
1 Respuestas
0
You can try with this code, encapsulte this in boolean property
if (this.WebBrowser.ReadyState != System.Windows.Forms.WebBrowserReadyState.Complete)
return false;
if (this.HtmlDomDocument == null)
return false;
foreach (IHTMLDOMNode node in this.HtmlDomDocument.all)
{
IHTMLFrameBase2 frame = node as IHTMLFrameBase2;
if (frame != null)
{
if (!frame.readyState.Equals("complete", StringComparison.OrdinalIgnoreCase))
return false;
}
}
return true;
Respondido 28 ago 12, 14:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas c# browser mshtml or haz tu propia pregunta.
to do it properly, check out some of the hints i provide in some of my previous answers, unfortunately, the available methods online are not anywhere near reliable enough, but if you implement the ideas i've provided under tag webbrowser-control you will get a better idea on how to do it reliably. - Erx_VB.NExT.Coder