I have a problem with WebBrowser Control when I try to set attribute for password element. It simply doesn't work. The password field is always empty(setting attribute for txtUName element works fine, also currentElement.InvokeMember("submit") works well). Problem is only with password element). Here is my code:
private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (webBrowser.ReadyState == WebBrowserReadyState.Complete)
{
foreach (HtmlElement he in webBrowser.Document.All.GetElementsByName("txtUName"))
{
he.SetAttribute("value", personalUsername);
}
foreach (HtmlElement he in webBrowser.Document.All.GetElementsByName("txtPass"))
{
he.SetAttribute("value", personalPassword);
}
foreach (HtmlElement currentElement in webBrowser.Document.GetElementsByTagName("Form"))
{
currentElement.InvokeMember("submit");
}
}
}
I try to set inner text value (he.InnerText = personalPassword;) but it still wont work. Any ideas? It' s very urgent. Thanks.