[VISUALBASIC 2010] Web Browser Problem Cant Find Login Button

Status
Not open for further replies.

Aristide

Old School
Original poster
old school
member
Joined
Apr 29, 2011
Posts
1,843
Reaction score
215
Points
158
Location
Milan, Italy
Hello guys i am tying to do a bot for mega upload for tbn users and i nearly finished i need one more thing; http://www.megaupload.com/?c=login i cant find the code for the login butto. usually i would have used
Code:
WebBrowser1.Document.GetElementById("login").InvokeMember("click")
but the login button doesnt have a code as it seems. does anyone have any ideas on this? what is the code? is there another way to emulate the login?
 

goku93

Senior
senior
member
Joined
Jun 13, 2011
Posts
465
Reaction score
81
Points
146
Use the tags,click a button without id search for the tutorial in http://howtostartprogramming.com/vb-net/

Or you can Focus in the textbox of the password and send a key (Enter)..
BTW what are you doing? im curios..
 
  • Like
Reactions: Aristide

Ace12

Senior
senior
Joined
May 2, 2011
Posts
1,013
Reaction score
369
Points
91
Location
Toronto
It doesn't have an id, but you can click it by class:

URL: http://www.megaupload.com/?c=login&next=c=login

Dim loginbutton As HtmlElementCollection = WebBrowser1.Document.All For Each WebPageElement As HtmlElement In loginbutton If WebPageElement.GetAttribute("className") = "log_but1" Then WebPageElement.InvokeMember("click") End If Next
 
  • Like
Reactions: Aristide

Aristide

Old School
Original poster
old school
member
Joined
Apr 29, 2011
Posts
1,843
Reaction score
215
Points
158
Location
Milan, Italy

goku93

Senior
senior
member
Joined
Jun 13, 2011
Posts
465
Reaction score
81
Points
146
yes sure maybe i can help you in something :)
 

Aristide

Old School
Original poster
old school
member
Joined
Apr 29, 2011
Posts
1,843
Reaction score
215
Points
158
Location
Milan, Italy
It doesn't have an id, but you can click it by class:

URL: http://www.megaupload.com/?c=login&next=c=login

Dim loginbutton As HtmlElementCollection = WebBrowser1.Document.All For Each WebPageElement As HtmlElement In loginbutton If WebPageElement.GetAttribute("className") = "log_but1" Then WebPageElement.InvokeMember("click") End If Next


ah, yes thanks for the code, but i put his in;
Code:
Dim loginbutton As HtmlElementCollection = WebBrowser1.Document.All
        If WebPageElement.GetAttribute("className") = "log_but1" Then WebPageElement.InvokeMember("click")
and it doesnt recognise the webpage element, what did i do wrong?
 
D

DTD

Guest
If i remember it correctly for each webpageelement as htmlelement in webbrowser1.document.all has to be added, im on ipod atm
 
  • Like
Reactions: Aristide

goku93

Senior
senior
member
Joined
Jun 13, 2011
Posts
465
Reaction score
81
Points
146
like DTD said you dindt put the for each part..

Code:
Dim loginbutton As HtmlElementCollection = WebBrowser1.Document.All
        For Each WebPageElement As HtmlElement In loginbutton


            If WebPageElement.GetAttribute("className") = "log_but1" Then


                WebPageElement.InvokeMember("click")
            End If
        Next
 
  • Like
Reactions: Aristide
Status
Not open for further replies.