Results 1 to 3 of 3

Thread: Help html element Click on a single push button

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2017
    Posts
    26

    Red face Help html element Click on a single push button

    Hello
    I have written many codes so that the program clicks on the buttons inside a page in the Webbrowser so that these buttons do not contain information or elements like me
    <Button>
    Test
    </ Button> is only text
    But I am now the problem that the program is clicking on the first button and I want to click all the buttons containing the text Test at once
    The codes you typed but clicked on the first button only:

    *Code:
    PHP Code:
    For Each Buttonc1 As HtmlElement In WebBrowser1.Document.GetElementsByTagName ("Button")
    ****************If 
    Buttonc1.InnerText TextBox1.Text Then
    ********************Buttonc1.InvokeMember ("Click")
    ****************
    End If 
    And

    *Code:
    PHP Code:
    *For Each ss As HtmlElement In WebBrowser1.Document.GetElementsByTagName ("Button")
    ****************If 
    ss.InnerText "Test" Then
    ********************Ss.InvokeMember ("click")
    *******************
    *************
    End if 
    This is a page I create http://arabi.yoo7.com/h9-page 'You must take into account the values on the page and placed in the above code
    I want the program to click all the buttons on the page at once by the above code
    Last edited by si_the_geek; Jun 22nd, 2017 at 08:57 AM. Reason: removed extra-large formatting

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Help html element Click on a single push button

    Right now your code iterates through each DOM element who's tag name is <button>, but inside the iteration you're checking if the InnerText value equals either a TextBox's text or the String literal "Test". If you want to click every DOM element who's tag name is <button>, then simply omit the conditional statement in the For/Each loop.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2017
    Posts
    26

    Re: Help html element Click on a single push button

    Actually it's a nice idea but the page contains many buttons and I want to click on the buttons containing the text <test > only
    my beloved brother

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