【发布时间】:2010-12-08 14:23:06
【问题描述】:
有没有办法在使用 webbrowser 控件时获取字符串的值并将其传递到网页中的文本框?
【问题讨论】:
有没有办法在使用 webbrowser 控件时获取字符串的值并将其传递到网页中的文本框?
【问题讨论】:
HtmlDocument doc = this.webBrowser1.Document;
doc.GetElementById("myId").SetAttribute("Value", "someValue");
试试这个
【讨论】:
您可以在 C# 中为 WebBrowser 控件进行浏览器自动化。
Here's the reference article 解释如何做到这一点。
【讨论】:
你可以这样做:
String newValue = "Sample Text";
HtmlElement txt = WebBrowser1.Document.GetElementById("ElementIdOnHtmlPage");
txt.SetAttribute("value",newValue);
【讨论】: