0
            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>

これどうやってするの?上記のコードは正しく機能しません。テキストは入力されません。

4

2 に答える 2

1
if (el.GetAttribute("name").Equals("_MYPW"))
{                        
    el.SetAttribute("value", "some text");
    clickNextButton(hec);
}

これはテキストをタイプします

于 2012-08-21T17:08:10.790 に答える