Winforms 如何从web浏览器读取数据
我需要从web浏览器读取数据,并将其中一些数据添加到我的数据库中。Winforms 如何从web浏览器读取数据,winforms,Winforms,我需要从web浏览器读取数据,并将其中一些数据添加到我的数据库中。 数据位于web浏览器表中。您可以通过获取对以下内容的引用来操作控件内加载的文档的DOM: if (webBrowser1.ReadyState == WebBrowserReadyState.Complete) { // find the table by id HtmlElement table = webBrowser1.Document.GetElementById("id_of_the_table");
数据位于web浏览器表中。您可以通过获取对以下内容的引用来操作控件内加载的文档的DOM:
if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
{
// find the table by id
HtmlElement table = webBrowser1.Document.GetElementById("id_of_the_table");
// use the table to extract data from columns and rows
foreach (HtmlElement rowElem in table.GetElementsByTagName("TR"))
{
string html = rowElem.InnerHtml;
// ...
}
}