-- 作者: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
|