我是csdn刚刚注册账户希望高手理解!用WinForm做一个采集小说的程序遇到问题如下: 获取某一个小说网站的排行榜标题以超链接的方式显示在界面上,然后点击每个标题获取每一个标题的值。目前我已经成功获取标题了 并用 webBrowser1控件来显示。现在就是获取不到 点击每一个标题的值? 搜索了很多资料关于webBrowser1这个控件的还是没有解决。请问有其他好点的控件吗能推荐一下,如果能用webBrowser1解决请高手提供一下解决把法O(∩_∩)O谢谢!!
调试欢乐多
再使用正则获取相关标签值
HtmlElementCollection htmlTabs = webBrowser1.Document.GetElementsByTagName("table");
string strValue = "";
int intII=0;
if(htmlTabs!=null&&htmlTabs.length>0)
{
HtmlElement htmlTable = htmlElements[0];
HtmlElementCollection htmlRows = htmlElement.GetElementsByTagName("tr");
HtmlElementCollection htmlCells = null;
foreach (HtmlElement htmlRow in htmlRows)
{
htmlCells = htmlRow.GetElementsByTagName("td");
foreach (HtmlElement htmlCell in htmlCells)
{
if (htmlCell.InnerText!=null)
{
strValue = htmlCell.InnerText.Trim();
}
}
}
}
<a href="/Book/1097961.aspx" target="_blank">重生无为</a> </br>
<a href="/Book/1409844.aspx" target="_blank">癫缘度空</a> </br>
<a href="/Book/1437605.aspx" target="_blank">道宗传人在异界</a> </br> 怎么实现点击每个标题获取不同的值呢?
就这个网站