Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27355

VS 2010 Need help with clicking a button in webpage

$
0
0
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

HTML Code:

<td class="dark" onclick="document.getElementById('action_id').value = '0'; document.getElementById('actionform').submit()">Do action</td>
I've tried this, but I guess there is something wrong here. Maybe another approach?

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

Any help will be greatly appreciated!

Viewing all articles
Browse latest Browse all 27355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>