WebBrowser如何得到csdn论坛左侧导航栏内容?
上图窗体上有两个按钮,一个text一个webbrowser,我想点操作列表按钮得到CSDN网页左侧的导航列表名称,按钮单击代码是这样写的:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click WebBrowser1.Navigate(New Uri("http://community.csdn.net/", System.UriKind.Absolute)) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click For i As Integer = 0 To WebBrowser1.Document.Window.Frames("NavigetionFrame").Document.All.Count - 1 TextBox1.AppendText(WebBrowser1.Document.Window.Frames("NavigetionFrame").Document.All(i).InnerText & vbCrLf) Next End SubEnd Class
<html><head> <title>CSDN社区首页 - CSDN.NET</title> <meta name="designer" content="CSDN.NET" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><frameset id="sidebar_content" cols="225, *" frameborder="1" border="6" framespacing="5" bordercolor="#A1C7F9"> <frame name="NavigetionFrame" src="/WebNavigation/Navigation.aspx" scrolling="no" frameborder="1" /> <frame name="ContentFrame" src="/HomePage.aspx" frameborder="0" /></frameset></html>