以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  网页xpath问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=169643)

--  作者:aidimeng
--  发布时间:2021/6/24 11:06:00
--  网页xpath问题


图片点击可在新窗口打开查看此主题相关图片如下:微信截图_20210624110332.png
图片点击可在新窗口打开查看

 

如果想获取 图中标记的 中文,这个路径怎么写啊


Dim hc As New HttpClient("http://www.foxtable.com/bbs/Query.asp/")
hc.SkipError=True
\'hc.Resp \'如果中文乱码,请改为 gbk
Dim hd As new Hap.HtmlDocument
hd.LoadHtml(hc.GetData())
For i As Integer=0 To 20
\'Dim xPath As String = "/table/tbody/tr["& i &"]/td[3]"
Dim xpath As String="/body/table#search/tbody/tr/td#searchmain1/div/form#bath/ul.search/li[1]"
Dim hn As Hap.HtmlNode = hd.DocumentNode.SelectSingleNode(xPath)
If hn IsNot Nothing Then
    Output.Show("InnerHtml:" & hn.InnerHtml)
 
End If
Next


--  作者:有点蓝
--  发布时间:2021/6/24 11:23:00
--  
msgbox(hn.Attributes("title").Value)