Question how to fill web forms and post through web browser?

jamesvick

Active member
Joined
Jul 19, 2010
Messages
34
Programming Experience
1-3
i have a form on one of my pages. How do i post the form after filling the data ? :

<form action='http://www.mysite.com/login.bml' method='post' class='lj_login_form pkg'>
<input type='hidden' name="lj_form_auth" value="c0:1279620000:865:86400:D8a3Ppn6DR-0-m5d4E2aEUQJXIvB:d696e52500ec16761d03da8e55d6a1c4" /><input type='hidden' name='chal' class='lj_login_chal' value='c0:1279620000:865:300:fh20VHeagtfjQ83RJlaM:0ddf0f828e8140c66e648307b44eaa7c' />
<input type='hidden' name='response' class='lj_login_response' value='' />
<h2>Log in to mysite</h2>

<fieldset class='pkg nostyle'>
<label for='user' class='left'>Username:</label>
<input type='text' value='' name='user' id='user' class='text' size='18' maxlength='17' style='' />
</fieldset>
<fieldset class='pkg nostyle'>
<label for='lj_loginwidget_password' class='left'>Password:</label>
<input type='password' id='lj_loginwidget_password' name='password' class='lj_login_password text' size='20' maxlength='30' /><a href='http://www.mysite.com/lostinfo.bml' class='small-link'>Forgot password?</a>
</fieldset>
<p><input type='checkbox' name='remember_me' id='remember_me' value='1' tabindex='4' /> <label for='remember_me'>Remember me</label></p><p><input name='action:login' type='submit' value='Log in...' /> <a href='http://www.mysite.com/openid/' class='small-link'>Login with Open ID</a></p><p><img src='http://l-stat.mysite.com/img/unpadlocked.gif' width='20' height='16' class='secure-image' alt='secure login' /> <a href='https://www.mysite.com/login.bml'>Secure</a> | Standard</p>

</form>



i fill form through web browser control in the following way :

WebBrowser1.Document.GetElementById("user").SetAttribute("value", "123")
WebBrowser1.Document.GetElementById("lj_loginwidget_password").SetAttribute("value", "xyz")

WebBrowser1.Document.Forms(0).InvokeMember("post")


this method does fill the form but does not post it. Any ideas on this?
 
Top Bottom