System.Windows.Forms.HtmlDocument document = this.webBrowser1.Document;
HtmlElementCollection hec = this.webBrowser1.Document.GetElementsByTagName("input");
foreach (HtmlElement el in hec)
{
if (el.GetAttribute("name").Equals("_MYPW"))
{
var form = this.webBrowser1.Document.Forms[0]; //form element
var input = form.Children[0]; //input element
input.SetAttribute("_MYPW", "type some text"); //set the input value
}
}
我想为
<input name="_MYPW" type=password>
我怎样才能做到这一点?上面的代码不能正常工作。它不输入任何文本。