Reputation: 139
i'm working on win form app that contains a web browser control, in the web page there is a text box field that i get it as htmlelement..
i fill it correctly with a string value, and then i want to send enter key press to submit the value in it ..
this is my code so far :
HtmlDocument hd = wbr.Document;//wbr is web browser control
HtmlElement he = hd.GetElementById("response_field");
he.SetAttribute("value", ans);//filled correctly
wbr.Select();
he.Focus();
he.InvokeMember("submit");
SendKeys.Send("{ENTER}");
i tried invoke member, tried sendkey but none of them works..
how to do this?
Upvotes: 2
Views: 9256
Reputation: 1234
From MSDN - Navigated:
// Navigates to the URL in the address box when
// the ENTER key is pressed while the ToolStripTextBox has focus.
private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Navigate(toolStripTextBox1.Text);
}
}
Upvotes: 0