Bry Man
01-28-2005, 01:49 AM
Hey,
Sorry for the kinda cruddy title but ill explain it better. I have been researching how to fill out a web based form using vb for some time now so I could make a progam that logs into a web based account and runs some errands and then signs out, after a long time on google I finally found a site that had exactly what I was looking for so I took it and am trying to adapt it to my needs. Here is the script
Const User = "SomeUser"
Const Pass = "SomePass"
Private Sub Command1_Click()
wb1.Navigate2 "http://us.mcafee.com/root/login.asp"
Do: DoEvents: Loop Until wb1.ReadyState = READYSTATE_COMPLETE
wb1.Document.Forms("LoginForm").elements("UserID").Value = User
wb1.Document.Forms("LoginForm").elements("Password").Value = Pass
wb1.Document.Forms("LoginForm").elements("submit1").Click
End Sub
And it corresponds to this web based form
<form action="Login.asp" method="post" id="LoginForm" name="LoginForm">
<div id="contentMain">
<input type="hidden" id="SUBMITTED" name="SUBMITTED" value="1" />
<input type="text" id="UserID" name="UserID" value="" style="width:175px" />
<input type="password" id="Password" name="Password" value="" style="width:175px" />
<input type="checkbox" id="RememberMe" name="RememberMe" />
<input type="submit" id="submit1" name="submit1" value=" Log In " style="font-size:11px" />
</div>
</form>
It works great for this form but the form im trying to use has alot of that info missing from it like the form name which is required as well as the submit buttons name. Here is the form im trying to have the program log into
<form action="login.php" method="post">
<input type="hidden" name="username">
<input type="hidden" name="pword">
<table align="center" class="small" style="padding: 0px 0px 5px 0px;" width="130">
<tr>
<td align="center"><font color="black">Username:</font></td>
</tr>
<tr>
<td align="center"><input class="login_input" type="text" name="usrname" value=""></td>
</tr>
<tr>
<td align="center"><font color="black">Email:</font></td>
</tr>
<tr>
<td align="center"><input class="login_input" type="text" name="uemail" value=""></td>
</tr>
<tr>
<td align="center"><font color="black">Password:</font></td>
</tr>
<tr>
<td align="center"><input class="login_input" type="password" name="psword"></td>
</tr>
<tr>
<td align="center" style="padding-top: 5px;"><input class="login_input" type="submit" value="Login" style="width: 50px;"></td>
</tr>
</table>
</form>
I am lost as to what I should do to make it log into the above form, if you could help me I would apprecate your time :)
*the vb code requires an instance of the webbrowser conrtol named wb1 to work*
Sorry for the kinda cruddy title but ill explain it better. I have been researching how to fill out a web based form using vb for some time now so I could make a progam that logs into a web based account and runs some errands and then signs out, after a long time on google I finally found a site that had exactly what I was looking for so I took it and am trying to adapt it to my needs. Here is the script
Const User = "SomeUser"
Const Pass = "SomePass"
Private Sub Command1_Click()
wb1.Navigate2 "http://us.mcafee.com/root/login.asp"
Do: DoEvents: Loop Until wb1.ReadyState = READYSTATE_COMPLETE
wb1.Document.Forms("LoginForm").elements("UserID").Value = User
wb1.Document.Forms("LoginForm").elements("Password").Value = Pass
wb1.Document.Forms("LoginForm").elements("submit1").Click
End Sub
And it corresponds to this web based form
<form action="Login.asp" method="post" id="LoginForm" name="LoginForm">
<div id="contentMain">
<input type="hidden" id="SUBMITTED" name="SUBMITTED" value="1" />
<input type="text" id="UserID" name="UserID" value="" style="width:175px" />
<input type="password" id="Password" name="Password" value="" style="width:175px" />
<input type="checkbox" id="RememberMe" name="RememberMe" />
<input type="submit" id="submit1" name="submit1" value=" Log In " style="font-size:11px" />
</div>
</form>
It works great for this form but the form im trying to use has alot of that info missing from it like the form name which is required as well as the submit buttons name. Here is the form im trying to have the program log into
<form action="login.php" method="post">
<input type="hidden" name="username">
<input type="hidden" name="pword">
<table align="center" class="small" style="padding: 0px 0px 5px 0px;" width="130">
<tr>
<td align="center"><font color="black">Username:</font></td>
</tr>
<tr>
<td align="center"><input class="login_input" type="text" name="usrname" value=""></td>
</tr>
<tr>
<td align="center"><font color="black">Email:</font></td>
</tr>
<tr>
<td align="center"><input class="login_input" type="text" name="uemail" value=""></td>
</tr>
<tr>
<td align="center"><font color="black">Password:</font></td>
</tr>
<tr>
<td align="center"><input class="login_input" type="password" name="psword"></td>
</tr>
<tr>
<td align="center" style="padding-top: 5px;"><input class="login_input" type="submit" value="Login" style="width: 50px;"></td>
</tr>
</table>
</form>
I am lost as to what I should do to make it log into the above form, if you could help me I would apprecate your time :)
*the vb code requires an instance of the webbrowser conrtol named wb1 to work*