Hi,
I want to use the SendKeys Methode to send keystrokes to a Webbrowser Control. Think about a form with the Webbrowser control and a button.
If you click on the button the key "a" should be send to the webbrowsercontrol. So i have informed myself and found the SendKey Methode. (the current code)
Code
webBrowser1.Focus();Code
SendKeys.Send("a");
Now my Problem! This is working but only every second click. So assume you click on the button the first time, then this wont work. When you click again on the button the a appears in the Webbrowser...
I also used webBrowser1.select(); and Sendkeys.Sendwait("a");
Any suggestions how this could be?
Thanks
Shlomi

Manoj BhoirRank #599 · 4K reputationPosted Jun 13, 2015, 8:30 PM EDT
shlomi gadol35 reputationPosted Jun 13, 2015, 9:10 PM EDT
Manoj BhoirRank #599 · 4K reputationPosted Jun 13, 2015, 9:17 PM EDT
If you know the id of the tag you can use below given code
if you dont know the id you can follow this code
foreach (System.Windows.Forms.HtmlElement html in WebBrowser1.Document.GetElementsByTagName("a"))