问题
Is there a way to take the value of a string and pass that to a textbox within a web page while using the webbrowser control?
回答1:
HtmlDocument doc = this.webBrowser1.Document;
doc.GetElementById("myId").SetAttribute("Value", "someValue");
try this
回答2:
You can do something like this:
String newValue = "Sample Text";
HtmlElement txt = WebBrowser1.Document.GetElementById("ElementIdOnHtmlPage");
txt.SetAttribute("value",newValue);
回答3:
You can do the browser automation in C# for WebBrowser control.
Here's the reference article explaining how you can do that.
http://www.codeproject.com/KB/cs/mshtml_automation.aspx
来源:https://stackoverflow.com/questions/1598780/c-sharp-pass-string-to-textbox-in-web-page-using-the-webbrowser-control