HtmlElement.InvokeMember, how wait until page loaded?

醉酒当歌 提交于 2019-12-24 10:44:44

问题


In my C# application I use WebBrowser object to read html include postbacks. To read default page by getting page I use WebBrowserDocumentCompletedEventHandler, like:

WebBrowser wb = new WebBrowser();
wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
wb.Navigate("http://mysite.com");

then in that event I have a page:

private void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    IsDocumentComplete = true;
    // here I can read the page
}

So, that event fires every time when I call Navigate method, but when I get some element on the page, invoke postback, I need to wait again until page loads again:

button.InvokeMember("onclick");

in that case wb_DocumentCompleted doesn't fire.

What is the way to know when page completely loaded.

Appreciate any help. thanks!


回答1:


Check these links , I think these links will help you

First Link : how to determine when page is loaded completely in webbrowser control in csharp?

Second Link :

How to know that WebBrowser control has finished loading all content including flash?

These both links are related to you question, Please check them , Those links will answer your question



来源:https://stackoverflow.com/questions/17449983/htmlelement-invokemember-how-wait-until-page-loaded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!