Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

(TuT) How to click a button that doesn’t have an ID in Webbrowser (/TuT) (VB.NET)

Hello g,

This tutorial will show you how to click a button that doesn’t have an ID. You just need the button's name.

1. Requirement :

- a computer (lol)
- a Visual Basic Project with : a form,
a webbrowser, and
_ a button.

2. Start tutorial :

A. Just put in Form_Load :
Code
WebBrowser1.Navigate("http://login.facebook.com/login.php")

B. In Button_Click put :
Code
Dim a As HtmlElementCollection = WebBrowser1.Document.All

For Each b As HtmlElement In a
    If b.GetAttribute("value") = "Log In" Then

    b.InvokeMember("click")

    End If
  Next

Source : http://howtostartprogramming.com/vb-net/...ithout-id/

I hope you like this tutorial
Sorry for my bad english :/
no add to the TUT on how to do without a ID or a Value
Smoke the weed


For Each Elements As HtmlElement In WebBrowser1.Document.All()
If Elements.GetAttribute("name") Like "submit" Then
Elements.InvokeMember("click")
End If
Next
(May 26, 2011 11:59 PM)Hell Guardian Wrote:  This is not a tutorial
You just copied/Pasted the code and didn't even comment it
Your "Method" won't work with every site
Because you can't guarantee that the Log In button Value will be "Log In"

You just change Log In To your needs...
[Image: ok2LiGx.jpg]
(May 27, 2011 01:41 AM)Hell Guardian Wrote:  What if the button doesn't have a value?
all I'm saying that this is not a tutorial as he doesn't even understand that code
I'm not trying to be an ass 😧
I just believe he just copied / Pasted the code

Oh, could be mate, i was making a bot maybe a week ago, and i needed this function... So this is really good thing, and you can use it to click pictures that are buttons :)
[Image: ok2LiGx.jpg]
(May 27, 2011 01:42 AM)Uncol Dolan Wrote:  Oh, could be mate, i was making a bot maybe a week ago, and i needed this function... So this is really good thing, and you can use it to click pictures that are buttons :)
You can get the Html element "Any thing not only buttons" by various ways
Title
Src
Name
Alt
Type
Value
etc
So i was just pointing that out 😊
I just want to help you :(
If this tut is not good, i will delete it ...
can you find the right attributes of update review button on facebook game review


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by The Pulp FictionApr 24, 2022 12:22 AM 2 199 Apr 24, 2022 12:22 AM
Last Post: The Pulp Fiction
[.NET] by triplextremeSep 15, 2020 02:29 PM 7 223 Sep 15, 2020 02:29 PM
Last Post: Dredd
[.NET] by requiredhqMay 27, 2020 08:38 AM 2 105 May 27, 2020 08:38 AM
Last Post: Yui Hirasawa