.net - Simulate ENTER-KEY in HTML-Form in C#? -
i want start off picture:
lets assume have form in visual c#.what want accomplish simulate "pressed enter key" on keyboard when im in html-element "textbox_name". tried sendkeys.send("{enter}");
has no effect. wrote value box this:
public void putbyclass(string classname, string value) { htmlelementcollection links = webbrowser1.document.all; foreach (htmlelement link in links) { if (link.getattribute("classname") == classname) { link.setattribute("value", value); } } } putbyclass("textbox_name_class", "john");
after line link.setattribute("value", value);
puts name "john" box want press "enter"-button on keyboard. thank in advance.
the problem need wire in event handlers in order referring to. since dealing webbrowser control don't have access underlying html , javascript. need inject javascript: how inject javascript in webbrowser control?
you have wire event handler yourself. inject javascript listen focus event of textbox , call submit.
Comments
Post a Comment