Question How to auto-login using WebBrowser control

darkhacks

New member
Joined
Jul 22, 2012
Messages
1
Programming Experience
Beginner
I have this:
VB.NET:
[COLOR=#660066]ListBox1[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]SelectedIndex[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]0[/COLOR]
[COLOR=#000000]
                [/COLOR][COLOR=#660066]Dim[/COLOR][COLOR=#000000] login [/COLOR][COLOR=#660066]As[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]String[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]ListBox1[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]SelectedItem[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]ToString[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Split[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]":"[/COLOR][COLOR=#666600])([/COLOR][COLOR=#006666]0[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]

                [/COLOR][COLOR=#660066]Dim[/COLOR][COLOR=#000000] has[/COLOR][COLOR=#666600]ł[/COLOR][COLOR=#000000]o [/COLOR][COLOR=#660066]As[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]String[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]ListBox1[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]SelectedItem[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]ToString[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Split[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]":"[/COLOR][COLOR=#666600])([/COLOR][COLOR=#006666]1[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]

                [/COLOR][COLOR=#660066]WebBrowser1[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Document[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]GetElementById[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"log"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]SetAttribute[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"value"[/COLOR][COLOR=#666600],[/COLOR][COLOR=#000000] login[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]
                [/COLOR][COLOR=#660066]WebBrowser1[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Document[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]GetElementById[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"pwd"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]SetAttribute[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"value"[/COLOR][COLOR=#666600],[/COLOR][COLOR=#000000] has[/COLOR][COLOR=#666600]ł[/COLOR][COLOR=#000000]o[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]

[/COLOR][COLOR=#000000]                [/COLOR][COLOR=#660066]WebBrowser1[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Document[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]GetElementById[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"wp-submit"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]InvokeMember[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"click"[/COLOR][COLOR=#666600])[/COLOR]

Now nicely put in field of the login and password information that is in the first listbox (They are separated by ":" ex login:password)
Only now I do not know how to do loops to repeat this action , until it logged in or address will change. :/
 
What exactly are you trying to do? I need a bit more information.
Your code selects the first item in the list box then fills the 'log' and 'pwd' inputs in the web browser control with the login details from the list box and then clicks the submit button, am I right?
What do you need to do after it has logged in? I didn't really get the part about looping. Do you want to repeat the login when the web browser control has finished loading the page after logging in?

Regards,
Bryce Gough
 
Back
Top