Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27368

Click Button in WebBrowser Control with changing ID

$
0
0
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

Viewing all articles
Browse latest Browse all 27368

Trending Articles