是否可以从Web浏览器控件中获取标记的内容,如下所示:<div class="desc">contents</div>
然后从中删除所有HTML字符?
说WebBrowser1已经加载了一个网站。我想从中提取源代码并找到它:
<div class="desc"><b>these are the contents I want</b></div>
并像这样提取:these are the contents I want
答案 0 :(得分:2)
Dim divs = WebBrowser1.Document.Body.GetElementsByTagName("div")
For Each d As HtmlElement In divs
If d.GetAttribute("className") = "desc" Then
Return d.InnerText
End If
Next