У меня есть этот код, чтобы извлечь весь элемент ввода формы в html-документе. в настоящее время я не могу получить select, textarea и другие элементы, кроме элемента ввода.
Dim htmldoc As HtmlDocument = New HtmlDocument()
htmldoc.LoadHtml(txtHtml.Text)
Dim root As HtmlNode = htmldoc.DocumentNode
If root Is Nothing Then
tsslStatus.Text = "Error parsing html"
End If
' parse the page content
For Each InputTag As HtmlNode In root.SelectNodes("//input")
'get title
Dim attName As String = Nothing
Dim attType As String = Nothing
For Each att As HtmlAttribute In InputTag.Attributes
Select Case att.Name.ToLower
Case "name"
attName = att.Value
Case "type"
attType = att.Value
End Select
If attName Is Nothing OrElse attType Is Nothing Then
Continue For
End If
Dim sResult As String = String.Format("Type={0},Name={1}", attType, attName).ToLower
If txtResult.Text.Contains(sResult) = False Then
'Debug.Print(sResult)
txtResult.Text &= sResult & vbCrLf
End If
Next
Next
Может ли кто-нибудь помочь мне в том, как получить все элементы во всех формах в html-документе?
Я нашел решение, я сделал это
Dim Tags As HtmlNodeCollection = docNode.SelectNodes("//input | //select | //textarea")
спасибо за просмотр