小编Ome*_*rus的帖子

Webbrowser SetAttribute 不工作(密码字段)

试图编写一个程序,它可以让我在 C# 中的网络浏览器中自动登录。这是我目前为此目的使用的代码:

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);
        }
Run Code Online (Sandbox Code Playgroud)

它填写用户名,而不填写密码?): 谷歌搜索,但只有少数人开始了没有人回复的话题。/:

希望有人可以帮助我。这是密码字段的源 auf:

<input type="password" value="" maxlength="50" size="25" name="password" class="bginput">
Run Code Online (Sandbox Code Playgroud)

c# browser passwords setattribute

4
推荐指数
1
解决办法
9440
查看次数

标签 统计

browser ×1

c# ×1

passwords ×1

setattribute ×1