How to get text from webbrowser without id
Hi everybody.
I need to extract text"Su saldo es 912C$" from Label in webbrowser control and pass it to textbox using vb.net 2012
HTML Code:
<form action="publicacion.php?op=1&cod=2" method="POST" class="form-horizontal">
<div class="control-group">
<label class="control-label"><strong>Su saldo es 912C$ </strong></label>
</div>
</form>
i have tried many ways not i cannot make it work please help me.
Re: How to get text from webbrowser without id
Your label has a class name. Iterate through all the HTMLDocument's elements checking which element has a class attribute set to control-label. If you find one in the iteration, then get that element and exit out the loop.
Re: How to get text from webbrowser without id
Code:
Dim tagCollection = WebBrowser1.Document.GetElementsByTagName("DIV")
For Each tagfound As HtmlElement In tagCollection
If tagfound.Children(0).DomElement.className = "control-label" And _
tagfound.DomElement.className = "control-group" Then
MsgBox(tagfound.OuterText)
End If
Next tagfound