Reputation: 13
i want to press a button in a website with the InvokeMember("click") code. Basically the websites html code is this one :
<em class='coins'>
<span class="click"></span>
And i tried using the answer found HERE but it doesn't seem to work. Do you know why? Am i doing something wrong?I also used the
If elem.InnerText = "Login" Then
but it didn't seem to help either. Here is the code in my Windows Form Application in Visual Studio :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
For Each elem As HtmlElement In WebBrowser1.Document.GetElementsByTagName("span")
If elem.GetAttribute("class") = "click" Then
elem.InvokeMember("click")
End If
End If
Next
End Sub
Sorry if this question counts as a duplicate, it is not the same as the other i made
Upvotes: 0
Views: 144
Reputation: 706
I think you must use (className) and (.Equals() for two strings) like this code:-
If elem.GetAttribute("className").Equals("free-coins-click") Then
elem.InvokeMember("click")
End If
End If
Upvotes: 1