Hack Forums
[.NET] VB need help simulating a keypress or keydown event on a webbrowser element - 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] VB need help simulating a keypress or keydown event on a webbrowser element (/showthread.php?tid=5931852)



VB need help simulating a keypress or keydown event on a webbrowser element - ChristmasNoob - Jan 20, 2019

ok so im making a follow bot but i need help simulating a keypress or keydown or some kind of typing simulation event on a webbrowser id element so that when i login the preset text "place email here" resets

https://gyazo.com/acf536631c5b0d662ef665f775966c87


RE: VB need help simulating a keypress or keydown event on a webbrowser element - HeadHoncho - Jan 28, 2019

You should be able to get the element by ID, and then put your desired text or variable in there..For example
Code
wb.Document.GetElementById("username").SetAttribute("value", txtEmail.text)

and then you can press the Login button once again by getting the element ID and then pressing the button
Code
For Each element As HtmlElement In wb.Document.GetElementsByTagName("a")
If element.GetAttribute("id") = "commentPost" Then
element.InvokeMember("click")
Exit For
End If
Next

you will need to edit the GetElementByID tags above to go with your own form. Hope it helps with what you're trying to do..