Hello, I have the following part of code for automatic login:
Then, I would like to get and echo some text displayed on the website in my app. However, the problem is that website's code looks like that:
As you can see table rows have no name="" or value="" so I can't find proper data by WebBrowser1.Document.GetElementsByTagName("Name_Here"). Is there any way to obtain data from this HTML in some other way?
Code:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
For Each curElement As HtmlElement In theElementCollection
Dim controlName As String = curElement.GetAttribute("name").ToString
If controlName = "login" Then
curElement.SetAttribute("Value", My.Settings.Username)
End If
Next [...]
HTML Code:
<table class="dataTable">
<tbody>
<tr>
<td class="rowName">Today's download earnings</td>
<td class="rowValue">$2.29</td>
<td width="2"></td>
<td class="rowName">Month's referrals earnings</td>
<td class="rowValue">$0.00</td>
</tr>
</tbody>
<tbody class="pair">
<tr>
<td class="rowName">Today's referrals earnings</td>
<td class="rowValue">$0.00</td>
<td width="2"></td>
<td class="rowName">Month's total earnings</td>
<td class="rowValue">$131.47</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="rowName">Today's total earnings</td>
<td class="rowValue">$2.29</td>
<td width="2"></td>
<td class="rowName">Last month earnings</td>
<td class="rowValue">$17.62</td>
</tr>
</tbody>
<tbody class="pair">
<tr>
<td class="rowName">Yesterday total earnings</td>
<td class="rowValue">$12.53</td>
<td width="2"></td>
<td class="rowName">Total money paidout</td>
<td class="rowValue">$34.10</td>
</tr>
</tbody>
</table>