我想要做的是从这个表中获取数据:
<div class="fliptable">
<div class="head">
<div class="outer">
<div class="inner">
Information</div>
</div>
</div>
<table class="body">
<tbody>
<tr>
<td class="key" style="">
SKU
</td>
<td class="right">
SKU1<br>
SKU2<br>
SKU3<br>
</td>
</tr>
<tr>
<td class="key" style="">
EAN
</td>
<td class="right" style="">
EAN1<br>
EAN2<br>
EAN3<br>
</td>
</tr>
</tbody>
</table>
我到目前为止的代码:
Dim doc As New HtmlAgilityPack.HtmlDocument()
doc.Load(WebBrowser1.DocumentStream)
Try
Dim key = doc.DocumentNode.SelectSingleNode("//div[@class='fliptable']//table[@class='body']//tr//td[@class='key']")
RichTextBox1.AppendText(key.InnerText & vbNewLine)
Dim right As HtmlNode = doc.DocumentNode.SelectSingleNode("//div[@class='fliptable']//table[@class='body']//tr//td[@class='right']")
For Each p As HtmlNode In right.SelectNodes("//div[@class='fliptable']//table[@class='body']//tr//td[@class='right']//br")
RichTextBox1.AppendText(p.PreviousSibling.InnerText.Trim() & vbNewLine)
Next
Catch ex As Exception
End Try
我得到的结果是:
SKU
SKU1
SKU2
SKU3
EAN1
EAN2
EAN3
我想要什么:
SKU
SKU1
SKU2
SKU3
EAN
EAN1
EAN2
EAN3
但我不能让我的生活让它发挥作用