// I have a button in an automatic form submitter's WebBrowser to
click. Current Code:
HtmlElement button;
HtmlElement field = wbbHp.Document.GetElementsByTagName("input")
['field1'];
string enteredName = txtAutoName.Text;
foreach(HtmlElement curEle in webBrowser1.Document.GetElementsByTagName
("input")
{
if (curEle.Name == 'field1')
{
button = curEle;
}
}
field.InnerText = enteredName;
button.Focus(); //go to the 'submit' button
SendKeys.Send("{ENTER}");
// The problem is that SendKeys does not work. SendKeys, however, is
the only way to trigger the "onclick" event
// that HTML hands off to javascript. There is no other way, as far
as I know, to click the Submit button AND get
// the onclick working without a lot of calls to the mouse position
APIs and finally to user32.dll to simulate a click
// event, which would be complicated.