Results 1 to 9 of 9
  1. #1
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108

    [TUT] Webbrowser Textbox/Button/Checkbox

    I'm basically going to teach you how to fill in data on a website.

    For instance on MPGH.

    We want our VB Application to connect to MPGH - MultiPlayer Game Hacking - Hack Hacks Downloads, Combat Arms Hacks, CrossFire Hacks, WarRock Hacks, Soldier Front Hacks, Sudden Attack Hacks, Operation 7 Hacks, AVA Hacks, Battlefield Hacks, Bad Company 2 Hacks, Call of Duty Hacks, Modern Warf and then fill in the ID/PW for us + hit the login button.

    First off all, we are going to take a deeper look into the source code of MPGH.

    We righ***ick on the textbox where to put the id in and hit "Research Element"(or whatever it is called in English). If you are using internet explorer/firefox/safari simply righ***1ck on the website and hit - View Source -

    Let us continue using google chrome. So, we righ***1ck on the user textbox and hit "Research Element".



    Afterwards, we are going to get this window, with the current textbox as source marked:



    Code:
    <input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';">
    id="navbar_username"

    We need the ID.

    Let's go into VB.

    Start a new project and call it whatever you want.



    Drag & Drop a "Webbrowser" control on your form.

    By default, the webbrowser is docked to all sides and is named "Webbrowser1".

    Now double click on your form and you will see the source code of your vb project:

    Code:
    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        End Sub
    End Class

    Form1_Load event obviously handles the action which is taken when the program is started.

    Navigating your browser to a specific website

    We are going to navigate the webbrowser to our mpgh site in order to login.

    Code:
    Webbrowser1.Navigate("https://www.mpgh.net/forum/")
    I think this does not need any further explanation.

    Moving on, we drag & drop a button on the form. If it does not work:

    Click on the Webbrowser control on your form and look at the extreme upper right corner ">"



    Now, you are actually able to drag & drop a button on your form.

    By doubleclicking on your button you will now see your source code again:

    Code:
    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            WebBrowser1.Navigate("https://www.mpgh.net/forum/")
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
        End Sub
    End Class
    Filling in a username

    On button_click event we want to fill in the username to the website.

    Therefore, we need the following code:

    Code:
    Webbrowser1.Document.GetElementById("ID of the element").InnerText = "Whatever"
    ->

    Code:
    Webbrowser1.Document.GetElementById("navbar_username").InnerText = "Blubb1337"
    If you want to be sure that the page is loaded when the data is filled in you can actually use the following code on form_load event:

    Code:
      While Not WebBrowser1.ReadyState = WebBrowserReadyState.Complete
                Button1.Enabled = False
            End While
    
            Button1.Enabled = True
    Filling in the password is going to be the same. You can figure out on your own.

    Checking a Checkbox

    Easy-method:

    Code:
    <input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c">
    Code:
    Webbrowser1.Document.GetElementById("cb_cookieuser_navbar").Focus
    Sendkeys.Send(" ") ' sending a space
    Our how code looks like this now:

    Code:
    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            WebBrowser1.Navigate("https://www.mpgh.net/forum/")
    
            While Not WebBrowser1.ReadyState = WebBrowserReadyState.Complete
                Button1.Enabled = False
            End While
    
            Button1.Enabled = True
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            WebBrowser1.Document.GetElementById("navbar_username").InnerText = "Blubb1337"
    
            WebBrowser1.Document.GetElementById("cb_cookieuser_navbar").Focus()
            SendKeys.Send(" ")
        End Sub
    End Class
    Clicking a button

    Either

    WebBrowser1.Document.GetElementById("btn").InvokeM ember("click")

    WebBrowser1.Document.GetElementById("btn").InvokeM ember("submit")

    or

    WebBrowser1.Document.Forms(0).Invoke("click")

    WebBrowser1.Document.Forms(0).Invoke("submit")

    SetAttributes

    When looking at a source of a element it looks like this:

    Code:
    <input id="imembernamelive" name="imembernamelive" type="text" maxlength="64" value="" onfocus="SignUp.ShowHelp('wlid')" onchange="SignUp.ValidateField(this)">
    value=""

    What we want to do is set the attribute "value" to something.

    To do that we need the following code:

    Code:
    Webbrowser1.Document.GetElementById("imembernamelive").SetAttribute(attributename as string, value as string)
    ->

    Code:
    Webbrowser1.Document.GetElementById("imembernamelive").SetAttribute("value", "Your username")
    So you can now check/uncheck a checkbox using SetAttribute.

    Code:
    <input type="checkbox" id="iOptinEmail" checked="false">
    Code:
    Webbrowser1.Document.GetElementById("IOptinEmail").SetAttribute("checked", "true")
    __________________________________________________ ___________

    I just quickly wrote this tutorial up.

    I do recommend you to use Google Chrome

    This is it for now =D

    I hope you did understand all.

    I do know that my English is a bit crappy in the beginning

    However, enjoy!

    Please post additional information.
    Last edited by Blubb1337; 05-05-2010 at 05:47 AM.



  2. The Following 2 Users Say Thank You to Blubb1337 For This Useful Post:

    ☆TIS☆ (05-05-2010),Erinador (05-05-2010)

  3. #2
    Erinador's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Posts
    224
    Reputation
    14
    Thanks
    111
    My Mood
    Bored
    never knew you could do that with Chrome

    Thanks for the useful tutorial.

  4. #3
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Google Chrome comes in VERY handy in this case. You don't really have to search the ids =D



  5. #4
    Spookerzz's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    4,647
    Reputation
    26
    Thanks
    572
    Wow I like you're current browser?

    You made that?

    MINION!

    xD
    I'm back.

  6. #5
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    It's google chrome >_< =D

    SetAttributes

    When looking at a source of a element it looks like this:

    Code:
    <input id="imembernamelive" name="imembernamelive" type="text" maxlength="64" value="" onfocus="SignUp.ShowHelp('wlid')" onchange="SignUp.ValidateField(this)">
    Code:
    vale=""
    What we want to do is set the attribute "value" to something.

    To do that we need the following code:

    Code:
    Webbrowser1.Document.GetElementById("imembernamelive").SetAttribute(attributename as string, value as string)
    ->

    Code:
    Webbrowser1.Document.GetElementById("imembernamelive").SetAttribute("value", "Your username")
    So you can now check/uncheck a checkbox using SetAttribute.

    Code:
    <input type="checkbox" id="iOptinEmail" checked="false">
    Code:
    Webbrowser1.Document.GetElementById("IOptinEmail").SetAttribute("checked", "true")
    Last edited by Blubb1337; 05-05-2010 at 05:37 AM.



  7. #6
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    HA HA, Google Chrome = Rocks

    Anyway, thanks for sharing


     


     


     



    The Most complete application MPGH will ever offer - 68%




  8. #7
    kaziboy's Avatar
    Join Date
    Jun 2008
    Gender
    male
    Location
    quebec
    Posts
    11
    Reputation
    10
    Thanks
    0
    My Mood
    Angelic
    hey could you explaine combo box's please -.- i dont get them

  9. #8
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by kaziboy View Post
    hey could you explaine combo box's please -.- i dont get them
    GTFO and stop bumping ancient threads.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  10. #9
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    Closed due to bump :\

Similar Threads

  1. [vid tut] how to make a webbrowser that can download.
    By trevor206 in forum Visual Basic Programming
    Replies: 2
    Last Post: 11-13-2009, 05:45 PM
  2. how to make a select all button for checkboxes
    By ac1d_buRn in forum Visual Basic Programming
    Replies: 5
    Last Post: 10-23-2009, 09:36 PM
  3. {TUT} Advanced WEBBROWSER
    By codyray90 in forum Visual Basic Programming
    Replies: 3
    Last Post: 01-28-2009, 09:52 AM
  4. [TUT]How to make a webbrowser
    By frono15 in forum Programming Tutorials
    Replies: 5
    Last Post: 07-02-2008, 01:53 AM
  5. [TuT]How to make a button to start Warrock
    By str1k3r21 in forum Visual Basic Programming
    Replies: 8
    Last Post: 11-10-2007, 10:25 AM