试图编写一个程序,在c#中的webbrowser中自动登录我。这是我目前用于此目的的代码:Webbrowser SetAttribute不起作用(密码字段)
HtmlElementCollection pageTextElements = loginBrowser.Document.GetElementsByTagName("input");
foreach (HtmlElement element in pageTextElements)
{
if (element.Name.Equals("username"))
element.SetAttribute("value", this.UserName);
if (element.Name.Equals("password"))
element.SetAttribute("value", this.Password);
}
它填写用户名,但不是密码? ): 谷歌搜索,但只有少数人开始话题,从来没有人回答。 /:
希望有人能帮助我。 这是源AUF密码字段:
<input type="password" value="" maxlength="50" size="25" name="password" class="bginput">
@亚当马拉斯感谢澄清。删除我的答案,因为我对此没有任何建议。 – 2010-11-24 18:41:40
您是否在设置密码字段属性的行上设置了一个断点,以查看它是否被击中? – 2010-11-24 18:42:59
是的,我做过。它会被击中,执行,但根本不会将密码放在框中。 – Omegavirus 2010-11-24 18:58:38