-
Hi.
I need some help with the Web Browser Control. You see. I want WB to fill in a form and then "POST" it like if you did it manually.
As you can see in the example below I want my program to fill in the "username" and "password" and then POST the information.
Can you please help me??? I'm desperate..
Best regards Johan Ryberg, SWEDEN
Example htmlpage:
Code:
<HTML>
<HEAD>
<SCRIPT>
<!--
function newPane(fls_host) {
pageUrl = "http://" + fls_host + "/serviceSelection.php3";
window.open(pageUrl,"selection",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=300,height=300');
}
//-->
</SCRIPT>
<SCRIPT>
<!---
var isButtonPressed = false;
function flsSubmit() {
if (isButtonPressed == false) {
isButtonPressed = true;
document.pwdenter.submit();
}
}
//-->
</SCRIPT>
<FORM NAME="pwdenter" ACTION="userlookup.php3" METHOD="POST">
<INPUT NAME="timestamp" TYPE=HIDDEN VALUE="948816493">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%" HEIGHT="100%">
<TR><TD>
<CENTER>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD>
<IMG SRC="telialogo.gif" ALT="logo" BORDER="0">
<FONT SIZE="-1" FACE="Geneva, Arial">
<BR><BR>
Mata in ditt användarnamn och lösenord nedan.<BR>
Tryck sedan på "Logga in".
<BR><BR>
Användarnamn:
<BR><INPUT NAME="username"><BR>
Lösenord:
<BR><INPUT NAME="password" TYPE=PASSWORD onBlur="this.form.username.focus();">
<BR>
<INPUT TYPE="BUTTON" NAME="submitForm" VALUE="Logga in " onClick="flsSubmit() ">
</TABLE>
</TABLE>
</FORM>
</body>
</HTML>
------------------
Best Regards rancor
[email protected]
http://www.sajberhem.nu
-
Hi Johan,
I believe that I can help you with this. Can you give me the URL of the web page that you want to fill in?
If so, I'll create the code to do this for you.
All the best.
Chris
-
Hi Johan,
Create a new VB project with a WebBrowser Control and 2 command buttons.
Paste this code into the VB Editor:
Code:
Option Explicit
Dim mICount As Integer
Private Sub Command1_Click()
mICount = 0
WebBrowser1.Navigate2 "www.hotmail.com"
End Sub
Private Sub Command2_Click()
Unload Me
End
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If pDisp Is WebBrowser1.Object Then
If mICount = 0 Then
SendKeys "Hi Johan"
SendKeys "{TAB 2}"
SendKeys "password"
SendKeys "{ENTER}"
mICount = 1
End If
End If
End Sub
This will fill in the Hotmail Web Page and attempt to log you in. You should easily be able to modify the code to fit the Web Page you want to interact with. Let me know if you have any problems.
All the best.
Chris