Results 1 to 13 of 13
  1. #1
    CodeHPro's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    116
    Reputation
    10
    Thanks
    76
    My Mood
    Aggressive

    webbrowser automating

    im going to post a bunch of code on webbrowser automating that i used to use when i just started learnign before i got into webrequest
    Click A Button
    Code:
    webbrowser1.Document.All("Button ID").InvokeMember("click")
    IF ID Exists
    Code:
     If WebBrowser1.Document.All("ID") Is Nothing Then
       Else
                MsgBox("ID  exsits")
            End If
    Click Button Just By Value Of It
    Code:
    Private Function GetBtnByValue(ByVal value As String) As HtmlElement
            For Each d As HtmlElement In Webbrowser1.Document.GetElementsByTagName("input")
                If (d.GetAttribute("type").ToLower = asd.Text Or d.GetAttribute("type").ToLower = "submit") Then
                    If (d.GetAttribute("value") = value) Then
                        Return d
                        Exit For
                    End If
                End If
            Next
        End Function
        Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
            GetBtnByValue("go").InvokeMember("Click")
        End Sub
    Click Check box
    Code:
       Dim outer As String = WebBrowser1.Document.All("PersistentCookie").OuterHtml
            WebBrowser1.Document.All("Check Box ID").OuterHtml = outer.Remove(outer.Length - 2) + " checked>"
    Click all Check box's with same value
    Code:
     For Each InputBx As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
                If (InputBx.GetAttribute("type").ToLower = "radio") AndAlso (InputBx.GetAttribute("value").ToLower = "Value Of Check Box") Then
                    InputBx.InvokeMember("Click")
                End If
            Next
    Fill Textbox In Webbrowser
    Code:
    For Each HTMLele As HtmlElement In WebBrowser1.Document.All
     If HTMLele.Name = "ID" Then
       HTMLele.SetAttribute("value", "someemail@somewhere.comValue")
      End If
     Next
    Get Text From Textbox In Webbrowser
    Code:
            Dim text As String = WebBrowser1.Document.All("Textbox ID).GetAttribute("value")
      TextBox1.Text = text
    Stop IE Pop ups
    Code:
    WebBrowser1.ScriptErrorsSuppressed = True
    Check URL
    Code:
     If WebBrowser1.Url.ToString = "URL" Then
    webbrowser contains
    Code:
     If WebBrowser1.DocumentTex*****ntains("Phrase") Then
            Else
            End If
    Webbrowser status
    Code:
     TextBox1.Text = WebBrowser1.StatusText
    Show Page Source
    Code:
      TextBox1.Text = webBrowser.Document.body.innerHTML
    Download Page
    Code:
            Dim MyWebClient As New System.Net.WebClient()
            TextBox1.Text = MyWebClient.DownloadString("URL")

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

    CoderNever (09-30-2009),Houston (10-01-2009),[MPGH]Liz (09-30-2009)

  3. #2
    Liz's Avatar
    Join Date
    Feb 2009
    Gender
    female
    Location
    179° 56′ 39.4″, +0° 2′ 46.2″, 7,940 ± 420 parsecs
    Posts
    37,181
    Reputation
    5621
    Thanks
    20,746
    My Mood
    Tired
    oouuuhh pretty, whats it do

    If anyone claims to be me via any other source outside of MPGH private or visitor messages, IT'S NOT ME!
    They are trying to trick or scam you. Report them immediately and PM me here for verification.
    "Don’t confuse my personality with my attitude. My personality is who I am. My attitude depends on who you are." — Frank Ocean
    Moderator: 5/2009-10/2009 | GMod: 10/2009-10/2010 | Staff Administrator: 10/2010-Present
    I
    do not do requests via PM. Post in the appropriate section.
     
    Stupid/Pointless Private messages = SPAM, SPAM = BAN.

  4. #3
    CodeHPro's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    116
    Reputation
    10
    Thanks
    76
    My Mood
    Aggressive
    Quote Originally Posted by Liz View Post
    oouuuhh pretty, whats it do
    just codes so if you want to make a bot to do an automated task for you

  5. #4
    Liz's Avatar
    Join Date
    Feb 2009
    Gender
    female
    Location
    179° 56′ 39.4″, +0° 2′ 46.2″, 7,940 ± 420 parsecs
    Posts
    37,181
    Reputation
    5621
    Thanks
    20,746
    My Mood
    Tired
    oh ouh, would this work with grease monkey?

    If anyone claims to be me via any other source outside of MPGH private or visitor messages, IT'S NOT ME!
    They are trying to trick or scam you. Report them immediately and PM me here for verification.
    "Don’t confuse my personality with my attitude. My personality is who I am. My attitude depends on who you are." — Frank Ocean
    Moderator: 5/2009-10/2009 | GMod: 10/2009-10/2010 | Staff Administrator: 10/2010-Present
    I
    do not do requests via PM. Post in the appropriate section.
     
    Stupid/Pointless Private messages = SPAM, SPAM = BAN.

  6. #5
    CodeHPro's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    116
    Reputation
    10
    Thanks
    76
    My Mood
    Aggressive
    Quote Originally Posted by Liz View Post
    oh ouh, would this work with grease monkey?
    no this is vb 2008 code

  7. The Following User Says Thank You to CodeHPro For This Useful Post:

    [MPGH]Liz (09-30-2009)

  8. #6
    Liz's Avatar
    Join Date
    Feb 2009
    Gender
    female
    Location
    179° 56′ 39.4″, +0° 2′ 46.2″, 7,940 ± 420 parsecs
    Posts
    37,181
    Reputation
    5621
    Thanks
    20,746
    My Mood
    Tired
    gotcha, thanks ^^

    If anyone claims to be me via any other source outside of MPGH private or visitor messages, IT'S NOT ME!
    They are trying to trick or scam you. Report them immediately and PM me here for verification.
    "Don’t confuse my personality with my attitude. My personality is who I am. My attitude depends on who you are." — Frank Ocean
    Moderator: 5/2009-10/2009 | GMod: 10/2009-10/2010 | Staff Administrator: 10/2010-Present
    I
    do not do requests via PM. Post in the appropriate section.
     
    Stupid/Pointless Private messages = SPAM, SPAM = BAN.

  9. #7
    Pixie's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Location
    Pixie wird wieder steigen.
    Posts
    1,884
    Reputation
    22
    Thanks
    229
    My Mood
    Fine
    Will this work on runescape?

  10. #8
    JIGS4W's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    2,906
    Reputation
    48
    Thanks
    156
    I need a more clear idea of this... Im very confused. Im still learning<------------chooby


  11. #9
    K4GE's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Posts
    311
    Reputation
    13
    Thanks
    65
    My Mood
    Inspired
    No Pixie, it wont work on RuneScape, since RuneScape is made in Java.
    And your webbrowser would never be able to acces the data in the RuneScape client.
    Last edited by K4GE; 09-30-2009 at 05:00 PM.

  12. The Following User Says Thank You to K4GE For This Useful Post:

    Pixie (09-30-2009)

  13. #10
    CoderNever's Avatar
    Join Date
    Feb 2009
    Gender
    female
    Location
    https://mpgh.net MPGHCash: $700,458,011
    Posts
    1,198
    Reputation
    131
    Thanks
    2,236
    My Mood
    Buzzed
    If I got this right , These are codes there interact with "Tools > Webbrowser" that you can use to furfill a simple task such as...Filling in a title textbox...so say you wanted to go to this page "https://www.mpgh.net/forum/newreply.php?do=newreply&noquote=1&p=######" and Fill in "Title:" With Web Codes , then you can set it to click a button in your Visual Basic Browser and then it will automatically fill it in with the data , which can be very useful for saving password information and getting your details typed in on a click of a button.

    Thanks , Was Very Useful information

  14. #11
    CodeHPro's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    116
    Reputation
    10
    Thanks
    76
    My Mood
    Aggressive
    Quote Originally Posted by K4GE View Post
    No Pixie, it wont work on RuneScape, since RuneScape is made in Java.
    And your webbrowser would never be able to acces the data in the RuneScape client.
    there is ways to send silent mouse clicks to the java window

  15. #12
    K4GE's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Posts
    311
    Reputation
    13
    Thanks
    65
    My Mood
    Inspired
    Well yes thats true, but you won't be able to do stuff like: filling forms, clicking buttons (without telling the location (X-Y)), and so on...
    But yes, what your saying is possible.

  16. #13
    CodeHPro's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    116
    Reputation
    10
    Thanks
    76
    My Mood
    Aggressive
    Quote Originally Posted by K4GE View Post
    Well yes thats true, but you won't be able to do stuff like: filling forms, clicking buttons (without telling the location (X-Y)), and so on...
    But yes, what your saying is possible.
    way easy all you need to do is find the button you want to click get the color of it and have vb get the x,y of the color and click that x,y ive done stuff like this many times

Similar Threads

  1. [Visual Basics Tutorial] How to make an advanced webbrowser
    By L3G0 in forum Programming Tutorials
    Replies: 26
    Last Post: 11-05-2012, 11:18 AM
  2. [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
  3. Favourite Webbrowser
    By Bull3t in forum General
    Replies: 43
    Last Post: 06-12-2009, 10:43 PM
  4. {TUT} Advanced WEBBROWSER
    By codyray90 in forum Visual Basic Programming
    Replies: 3
    Last Post: 01-28-2009, 09:52 AM
  5. [TUT]How to make a webbrowser
    By frono15 in forum Programming Tutorials
    Replies: 5
    Last Post: 07-02-2008, 01:53 AM

Tags for this Thread