public static void SetText(this HtmlControl control, string text)
{
if (control.TagName == "input")
{
HtmlInputText ctrl = new HtmlInputText(control.BaseElement);
ctrl.OwnerBrowser.Manager.Desktop.KeyBoard.KeyPress(Keys.Tab);
ctrl.Text = string.Empty;
ctrl.Focus();
ctrl.ExtendedMouseClick();
ctrl.Text = text;
ctrl.OwnerBrowser.Manager.Desktop.KeyBoard.KeyPress(Keys.Space);
ctrl.OwnerBrowser.Manager.Desktop.KeyBoard.KeyPress(Keys.Tab);
}
else
{
control.Focus();
control.ExtendedMouseClick();
control.OwnerBrowser.Manager.Desktop.KeyBoard.TypeText(text);
control.OwnerBrowser.Manager.Desktop.KeyBoard.KeyPress(Keys.Tab);
}
}