Witam,

Piszę program to automatycznego wypełniania formularza na stronie; poprzez framework SELENIUM wszystko idzie poprawnie, aczkolwiek chciałbym, aby program był skompilowany do .exe. Problem pojawił się przy logowaniu na stronę; podaję fragment strony www

<td>Nazwa użytkownika:</td>
<td>
<input type="text" autocomplete="off" style="width: 150px" maxlength="25" name="j_username">
</td>
</tr>
<tr>
<td>Hasło:</td>
<td>
<input type="password" autocomplete="off" style="width: 150px" name="j_password">
</td>
</tr>

td colspan="2" style="text-align: center">
<input type="submit" value="Zatwierdź">
</td>
 

a o to kod w C#, którym chcę się zalogować

oid webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

            HtmlElementCollection log = webBrowser1.Document.GetElementsByTagName("j_username");
                foreach(HtmlElement t in log)
            {
                if (t.GetAttribute("type").Equals("text"))
                    

                    {   
                    t.SetAttribute("type", "xxxxxxxxx");
                    }
            }

            HtmlElementCollection pas = webBrowser1.Document.GetElementsByTagName("j_password");
            foreach (HtmlElement z in pas)
            {
                if (z.GetAttribute("type").Equals("password"))
                {

                    z.SetAttribute("password", "xxxxxxxxxxxx");
                }

            }


            HtmlElementCollection bangs = webBrowser1.Document.GetElementsByTagName("input");
            foreach (HtmlElement k in bangs)
            {
                if (k.GetAttribute("type").Equals("submit"))
                {

                    k.InvokeMember("click");
                }

            }
 

Strona ładuje się z informacją o błędnym użytkowniku; wcześniej bez problemu logowałem się na strony poprzez "GetElementsById" ale z "GetElementsByTagName" mam problem...