0

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.

2
Contributors
1
Reply
7
Views
3 Years
Discussion Span
Last Post by cgeier
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.