Results 1 to 9 of 9

Thread: web browser invoke member click

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2009
    Posts
    79

    web browser invoke member click

    Hello. I am making a WoW automatic trial account creator and so far i have it so that on this link:

    https://us.battle.net/account/creation/wow/signup/

    it will fill out all of the information.

    Code:
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            WebBrowser1.Document.All("firstName").InnerText = txtFirstName.Text
            WebBrowser1.Document.All("lastName").InnerText = txtLastName.Text
            WebBrowser1.Document.All("emailAddress").InnerText = txtEmail.Text
            WebBrowser1.Document.All("emailAddressConfirmation").InnerText = txtEmail.Text
            WebBrowser1.Document.All("password").InnerText = txtPass.Text
            WebBrowser1.Document.All("passwordConfirmation").InnerText = txtPass.Text
            WebBrowser1.Document.All("touAgree").SetAttribute("checked", "true")
           
        End Sub
    The only problem I am having is that when I try to make it automatically submit it isnt working because I can't find the id of the button. When I inspect it on the website it is a javascript button and I am not sure how to make it click.

    I tried
    Code:
     'WebBrowser1.Document.All("Submit").InvokeMember("click")
    But it still didn't work. Any help would be much appreciated! Thanks

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2009
    Posts
    79

    Re: web browser invoke member click

    *BUMP*

    Also, will javascript even work in the webbrowser?

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: web browser invoke member click

    try this:

    vb Code:
    1. For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a")
    2.     If element.GetAttribute("className") = "submit" Then
    3.         element.InvokeMember("click")
    4.     End If
    5. Next

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2009
    Posts
    79

    Re: web browser invoke member click

    Quote Originally Posted by .paul. View Post
    try this:

    vb Code:
    1. For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a")
    2.     If element.GetAttribute("className") = "submit" Then
    3.         element.InvokeMember("click")
    4.     End If
    5. Next
    it still doesn't press the submit button. I inspected the element and it has no id its just a javascript thing.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2009
    Posts
    79

    Re: web browser invoke member click

    <a xmlns="http://www.w3.org/1999/xhtml" href="javascript:;" onclick="Form.submit(this);" class="submit" style="">
    Play Free Trial
    </a>

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: web browser invoke member click

    <a xmlns="http://www.w3.org/1999/xhtml" href="javascript:;" onclick="Form.submit(this);" class="submit" style="">
    Play Free Trial
    </a>

    tagName = a
    className = submit

    i tested it. it worked

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2009
    Posts
    79

    Re: web browser invoke member click

    oh i tried and it didnt work. ill try again

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2009
    Posts
    79

    Re: web browser invoke member click

    Okay, I tried it but it seems that it only presses submit if the boxes are empty. If the boxes are filled up with information and then i do that code to press submit it just does nothing. Any ideas?

  9. #9
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: web browser invoke member click

    there's something wrong with the website. i filled all the fields correctly, then clicked the button manually + nothing happened. i'd say the website isn't working properly.

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