我遇到了一个奇怪的问题。我正在尝试通过设置两个输入的值属性并调用单击提交输入来使用网络浏览器登录网站,一个输入用于用户名,另一个用于密码。
HtmlElement tempElement;
// typing email of the user to the email textbox.
tempElement = browser.Document.GetElementById("txtUserName");
tempElement.SetAttribute("value", userName);
// typing password of the user to the password textbox.
tempElement = browser.Document.GetElementById("txtPassoword");
tempElement.SetAttribute("value", "123456");
现在根据需要设置用户名输入的值,但设置密码输入的值不起作用。我试图只更改密码输入的OuterHtml但它仍然没有改变,似乎尝试更改密码输入的每件事都不起作用。
有人知道为什么设置密码输入的 value 属性不起作用吗?