C#检测回传的WebBrowser控件 [英] C# detect postback in webbrowser control

查看:212
本文介绍了C#检测回传的WebBrowser控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个从网页抓取数据并保存到数据库的应用程序。此页面发送一些__postbacks。回发后,页面加载一些数据,我需要保存。我不知道如何让我创建了一个按钮,当用户按下它抓住了数据检测此事件。
我如何可以自动的过程,这样用户就不必检查回传自己?
这就是我怎么能检测回发事件在我的WebBrowser控件?

I've created an application that grabs data from a web page and saves them to a database. This pages sends some __postbacks. After the postback the page loads some data that I need to save. I do not know how to detect this event so I've created a button which grabs the data when pressed by the user. How can I automate the process so that the user won't have to check for the postback himself? That is how can I detect the postback event in my webbrowser control?

推荐答案

WebBrowser控件有一个DocumentCompleted事件。您可以使用 WebBrowser.Document 属性来查找特定的本次活动的东西。

The webbrowser control has a DocumentCompleted event. You can use the WebBrowser.Document property to look for something specific in this event.

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) {
  if (webBrowser1.Document.Body.InnerHtml.Contains("some way that I know I am ready"))
  }

这篇关于C#检测回传的WebBrowser控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆