I'm trying to click a button in a website from my program. But I'm having no luck at all.
This the element im trying to click
I've tried this, but I guess there is something wrong here. Maybe another approach?
Any help will be greatly appreciated!
This the element im trying to click
HTML Code:
<td class="dark" onclick="document.getElementById('action_id').value = '0'; document.getElementById('actionform').submit()">Do action</td>
Code:
Private Sub DoAction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DoAction.Click
Dim elements As HtmlElementCollection = webbrowser1.Document.All
For Each element As HtmlElement In elements
If element.GetAttribute("value") = "0" Then
element.InvokeMember("click")
End If
Next
End Sub