Results 1 to 21 of 21

Thread: Click Button in WebBrowser Control with changing ID

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2013
    Posts
    40

    Click Button in WebBrowser Control with changing ID

    If I had a button with the ID of

    id="fbSingle_43b9a20f6f0e6bdcae16bc23192083"

    But besides the line "fbSingle_" Everything else changes upon the page refresh, how could I click the button using this code-->

    Code:
    WebBrowser1.Document.All("Button ID").InvokeMember("click")
    But instead of finding the exact ID, the webbrowser looks up if the Document has an ID containing a certain string. Almost like how in a textbox you would use

    Code:
    If Textbox1.Text.Contains("fbSingle_") Then
    'Do Something
    End If
    Thank you all

    Also,
    if you know how to click a button by the text on the button, that would be very helpful. The button I am trying to click is
    Code:
    <div class="btn3">Like</div>
    Though if you open up the XPath, it is
    Code:
    //*[@id="fbSingle_43b9a20f6f0e6bdcae16bc23192083"]/div/center[2]/a/div
    Last edited by johnwillmikul; Mar 8th, 2013 at 04:36 PM. Reason: New Info for better answers

Tags for this Thread

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