Hack Forums
[.NET] Clicking a button with no ID? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Clicking a button with no ID? (/showthread.php?tid=4252809)



Clicking a button with no ID? - Drizzy‎‎ - May 27, 2014

I'm trying to click a button on a webpage, but there is no ID so I can't exactly identify it:
Here is the inspect element:
<button title="Show Lat Long converted address on Map" onclick="showlatlong();">Convert to Address</button>

If you want the website, here it is:
http://www.latlong.net/Show-Latitude-Longitude.html

I'm trying to click the "Convert to Address" button using the webbrowser control. Thanks. 🤝


* - chaddiablo - May 27, 2014

(May 27, 2014 06:10 PM)Drizzy763763 Wrote:  I'm trying to click a button on a webpage, but there is no ID so I can't exactly identify it:
Here is the inspect element:
<button title="Show Lat Long converted address on Map" onclick="showlatlong();">Convert to Address</button>

If you want the website, here it is:
http://www.latlong.net/Show-Latitude-Longitude.html

I'm trying to click the "Convert to Address" button using the webbrowser control. Thanks. 🤝

Try:
Code
webbrowser1.Document.GetElementsByTagName("button")



* - LordCoder - May 28, 2014

Code
For Each elm As HtmlElement In webBrowser1.Document.All
    If elm.GetAttribute("title") = "Show Lat Long converted address on Map" Then
    elm.InvokeMember("click")
    End If
Next