Jun 27, 2010 11:45 AM
(This post was last modified: Jul 25, 2010 09:31 AM by H3x0S.)
I saw that many people can't find a way to click a button without ID in WebBrowser control, so here is a solution! 🤗
I've created a function that will do that!
Usage:
Explanation:
Let's say that you have a button that doesn't have an ID.
Button code is:
You would use this function like this:
Thanks to Eleqtriq for inspiration.
PLEASE GIVE CREDITS IF USED!
I've created a function that will do that!
Code
'Author: H3x0S
'Release Date: June/27/2010
Public Function ClickWBElement(ByVal TagName As String, ByVal Attribute As String, ByVal AttributeContains As String)
Dim ElCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName(TagName)
For Each Element As HtmlElement In ElCollection
If Element.GetAttribute(Attribute).Contains(AttributeContains) Then
Element.InvokeMember("click")
End If
Next
ClickWBElement = True
End FunctionUsage:
Code
ClickWBElement("BUTTON", "ATRIBUTE", "ATRIBUTETEXT")Explanation:
Let's say that you have a button that doesn't have an ID.
Button code is:
Code
<button class="login">LOGIN</button>You would use this function like this:
Code
ClickWBElement("button", "class", "login")Thanks to Eleqtriq for inspiration.
PLEASE GIVE CREDITS IF USED!




![[Image: Xtddh8V.png]](https://i.imgur.com/Xtddh8V.png)