Results 1 to 6 of 6

Thread: [RESOLVED] Click button on webbrowser(autologin)

Threaded View

  1. #2
    Frenzied Member stateofidleness's Avatar
    Join Date
    Jan 2009
    Posts
    1,780

    Re: Click button on webbrowser(autologin)

    i'm not sure how to do it when there is no ID given, but something like this would be done after you know you have the correct button:

    vb.net Code:
    1. Me.Webbrowser1.document.forms(0).InvokeMember("Click")

    im not 100% on the syntax, but basically, since it doesn't have an ID, you'll have to iterate through the pages forms and find the right one, then invoke a click event on that button

    EDIT

    vb.net Code:
    1. Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
    2.         For Each curElement As HtmlElement In theElementCollection
    3.             Dim controlName As String = curElement.GetAttribute("value").ToString
    4.             If controlName = "Log In" Then
    5.                 curElement.InvokeMember("Click")
    6.             End If
    7.         Next

    that should work. i looked at the source of that page and they have:
    <input type="submit" value="&nbsp;Log In&nbsp;">

    so you might need to change "Log In" to "&nbsp;Log In&nbsp;" in the code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width