i am creating a program that will log into a copier's web interface and automatically enter information without the user seeing.
I found a code that will log into yahoo mail and click the submit button
WebBrowser1.Navigate(TextBox1.Text)
WebBrowser1.Document.GetElementById("Admin").SetAttribute("value", TextBox3.Text)
WebBrowser1.Document.GetElementById("PASS").SetAttribute("value", TextBox4.Text)
WebBrowser1.Document.GetElementById(".submit").InvokeMember("click")
this code does not work on the copiers web interface, here's what the page source looks like
i would like to have textbox 3 as the user name and textbox4 as the password and another button to click login
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=windows-1252">
<LINK REL="stylesheet" TYPE="text/css" HREF="/TopAccess/style.css">
<SCRIPT SRC="/TopAccess/js/Validation.js"></SCRIPT>
<SCRIPT LANGUAGE="javascript">
function fnbValidateLogin()
{
lsPassword = window.document.frmLogin.elements["PASS"].value;
var liSize = lsPassword.length;
if(window.document.frmLogin.elements["USERNAME"].value != "Admin")
{
alert("Please enter valid username.");
window.document.frmLogin.elements["USERNAME"].select();
return false;
}
if ( (liSize < 6 || liSize > 10) || fnbValidatePassword(lsPassword) )
{
alert("Please enter valid Password.");
window.document.frmLogin.elements["PASS"].focus();
window.document.frmLogin.elements["PASS"].value = "";
return false;
}
objForm = window.document.frmLogin;
objForm.method = "POST";
objForm.target = "_parent";
objForm.action = "/ADMIN/Login";
objForm.submit();
return false;
}
function fnbFocusonLoad()
{
if(window.document.frmLogin.elements.length >= 1)
{
window.document.frmLogin.elements["PASS"].focus();
}
return false;
}
function fnKeyUp()
{
if(navigator.appName != "Netscape")
{
if(event.keyCode==13){
fnbValidateLogin();
}
}
return false;
}
function netscapeKeyPress(e)
{
if((e.which==13) || (e.which==3))
{
fnbValidateLogin();
}
}
if (document.layers)// Hema added for netscape 4.76 support on 18th december 2003
{
window.captureEvents(Event.KEYPRESS);
window.onKeyPress = netscapeKeyPress;
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" ONLOAD="fnbFocusonLoad();return false;" CLASS=clsMargin>
<SPAN CLASS="clsTitle1">
Login<BR>
</SPAN>
<FORM NAME="frmLogin">
<TABLE WIDTH=700 BORDER=0 CELLPADDING=2 BGCOLOR=white>
<TR>
<TD>
<!-- Hema changed the type to submit for supporting enter key press in netscape 7 on 18th dec 2003-->
<INPUT TYPE=submit NAME=Login VALUE="Login" onclick="return fnbValidateLogin()">
</TD>
</TR>
</TABLE>
<!--Hema changed the alignment of the password fields for windows XP bug-->
<TABLE WIDTH=410 BORDER=0 BGCOLOR=white>
<TR>
<TD WIDTH="32%" ALIGN=left CLASS="clsTableElement">User Name </TD>
<TD WIDTH="68%" ALIGN=left><INPUT TYPE=text SIZE=31 NAME="USERNAME" VALUE="Admin"></TD>
</TR>
</TABLE>
<TABLE WIDTH=410 BORDER=0 BGCOLOR=white>
<TR>
<TD WIDTH="32%" ALIGN=left CLASS="clsTableElement">Password </TD>
<TD WIDTH="68%" ALIGN=left><INPUT TYPE=password SIZE=31 MAXLENGTH="10" NAME="PASS" ></TD><!--Hema added onkeyup function on 16th december 2003 -->
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>