Sign in to follow this  
Followers 0
gdijim

autologin to a PITA database help! :)

2 posts in this topic

Hey all,

I've got the following code set up to login to a web database, which also has its code included below. It won't login, and I'm trying to find out why. It's an internal database, so people can't really see the login page from outside the company. Sorry :P

The database front end is some really screwy java scripting, and I'm wondering if that's not messing it up?

Have a look and tell me what you think:

#include <IE.au3>

$oIE = _IECreate("generic database website here")

;~ _IENavigate($oIE, "generic database website here")

; get pointers to the login form and username and password fields

$o_form = _IEFormGetObjByName($oIE, "e_login_main_start")

$o_login = _IEFormElementGetObjByName($o_form, "loginuser")

$o_password = _IEFormElementGetObjByName($o_form, "loginpass")

; Set field values and submit the form

_IEFormElementSetValue($o_login, "testlogin")

_IEFormElementSetValue($o_password, "testpass")

;~ Sleep(2000)

_IEFormSubmit($o_form)

Exit

Now, here is the source code of the webpage. I believe I've correctly identified the formname, loginname, and password parts of the form. However, nothing ever keys into the page when I use the macro.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HEAD xmlns:oaa="http://peregrine.com/oaa/3.0"><META http-equiv="Content-Type" content="text/html; charset=UTF-8">

<TITLE>Welcome</TITLE>

&lt;script src="js/setDomain.js" type="text/javascript"></SCRIPT>&lt;script src="js/globals.js" type="text/javascript"></SCRIPT>&lt;script SRC="js/FormValidation.js" type="text/javascript"></SCRIPT>&lt;script src="js/currency.js" type="text/javascript"></SCRIPT>&lt;script type="text/javascript">

_RootPage="login.jsp";

_HomePage="appmenu.jsp";

_LogoutPage="e_logout_main_auto.do";

_ExpiredPage="e_logout_main_expired.do";

var thisPage = new WebPage();

if( top.getit_main && top.getit_main == this || !top.getit_main && top == this && top.opener == null ){

setCurrentPage(thisPage); thisPage.isPopUp=false;

}

//this will allow popup windows to benefit from the currnetPage mechenism and all its variables

else { setCurrentPage(thisPage); thisPage.isPopUp=true; }

thisPage.strTitle = "Welcome";

thisPage.intTimeout = 1240000;

thisPage.strBookmarkSession = "BF88C7CF3F44FEE09747365911A0CA8D";

thisPage.strAppTitle = "";

thisPage.strSetHeader = "true";

thisPage.strNavigate = "TreeMenu";

thisPage.strModule = "login";

thisPage.strActivity = "main";

thisPage.strForm = "start";

thisPage.strNoFormFocus = "false";

thisPage.strSubmit = "Login";

thisPage.strSubmitAction = "java script:trySubmit('e_login_main_process.do','true','','e_login_main_start','submit1',null,'top=20,left=20,alwaysRaised=1,scrollbars=0,width=550,height=550','post'); void(0);";

thisPage.validateForm = "true";

thisPage.strHelpMsg = "Help topics for the Peregrine Portal";

thisPage.strHelpURL = "";

thisPage.strConfigure = "";

thisPage.strConfigureURL = "";

thisPage.strTranslate = "";

thisPage.strTranslateURL = "";

thisPage.bDisplayFormInfo = false;

thisPage.bLogout = true;

thisPage.stronload = "";

thisPage.strAccess = "USER_UNKNOWNclassic.css;classic";

thisPage.strLanguage = "en";

thisPage.strCountry = "";

thisPage.strStylesheet = "css/classic.css";

thisPage.strImagePath = "images/skins/classic/";

thisPage.strSidebarForm = "";

thisPage.strSidebar = "";

thisPage.strUserName = "";

preloadImages("images/load_animation.gif");

</SCRIPT>&lt;script type="text/javascript">

function Field(strName,strLabel,strValue,strRequired){

this.Name = strName;

this.Label = strLabel;

this.Value = strValue;

this.Required = strRequired;

}

var arField = new Array();

var objFields = new Object();

var ilgt = 0;

var theField = null;

//from outputVerify template

// Used to verify that required fields have been filled out

//var nSubmit = 0;

function verify( f, bSubmitToSelf ){

return verifyFields ( bSubmitToSelf,"Please enter information for the following required field(s):\n");

}

</SCRIPT>

<LINK rel="stylesheet" type="text/css" href="css/classic.css">

<LINK rel="stylesheet" type="text/css" href="common/common.css">

</HEAD>

<BODY class="BodyAlt" onload="return doPageLoad();" onunload="return doPageUnload();" background="images/skins/classic/login.jpg" marginwidth="8" marginheight="8" topmargin="8" leftmargin="8">

&lt;script type="text/javascript">genPopupHeader( thisPage );</SCRIPT>

<TABLE width="100%">

<TR>

<TD class="FieldText">Please enter your user name and password to enter the Peregrine Portal.<br/> </TD>

</TR>

</TABLE>

<FORM name="e_login_main_start" id="e_login_main_start" onsubmit="return verify(this,true);" action="java script:trySubmit('e_login_main_process.do','true','','e_login_main_start','',null,null,null); void(0)" method="post">

<INPUT value="__y" name="__x" id="__x" type="hidden"><INPUT value="" name="_blankFields" id="_blankFields" type="hidden"><INPUT value="e_login_main_start.do" name="_callingform" id="_callingform" type="hidden"><INPUT value="" name="_backform" id="_backform" type="hidden"><INPUT value="" name="_ctxobj" id="_ctxobj" type="hidden"><INPUT value="" name="_ctxidfld" id="_ctxidfld" type="hidden"><INPUT name="_ctxidval" id="_ctxidval" type="hidden" value=""><INPUT value="" name="_ctxschema" id="_ctxschema" type="hidden">

<TABLE class="" border="0" cellpadding="2" cellspacing="0" title="User selectable list of supported languages" width="100%">

<TR>

<TD style="white-space:nowrap;" class="FieldLabel" width="15%"><LABEL class="FieldLabel" title="User Name" for="loginuser">User Name: 

</LABEL></TD><TD class="FieldLabel"></TD><TD valign="top" class="FieldText"><INPUT size="30" name="loginuser" type="text" id="loginuser" value="" title="User Name"><IMG alt="Required Field" src="images/skins/classic/required.gif">&lt;script type="text/javascript">

addFieldToArray(arField,objFields,"loginuser","User Name","true","");

</SCRIPT></TD>

</TR>

<TR>

<TD style="white-space:nowrap;" class="FieldLabel" width="15%"><LABEL class="FieldLabel" title="Password" for="loginpass">Password: 

</LABEL></TD><TD class="FieldLabel"></TD><TD valign="top" class="FieldText"><INPUT size="30" name="loginpass" type="password" id="loginpass" value="" title="Password">&lt;script type="text/javascript">

addFieldToArray(arField,objFields,"loginpass","Password","false","");

</SCRIPT></TD>

</TR>

<TR>

<TD style="white-space:nowrap;" class="FieldLabel" width="15%"><LABEL class="FieldLabel" title="User selectable list of supported languages" for="">Language: 

</LABEL></TD><TD class="FieldLabel"></TD><TD valign="top" class="FieldText">&lt;script type="text/javascript">

function setLanguage(language) {

var d = new Date();

d.setTime( d.getTime() + (1000 * 60 * 60 * 24 * 365) );

var s = "language="+language+"; expires="+d.toGMTString();

top.document.cookie = s;

top.location.href = "login.jsp";

}

</SCRIPT><SELECT onchange="setLanguage(this.options[this.selectedIndex].value)" size="1" class="FieldText" name="OAAlanguageField" id="OAAlanguageField" title="User selectable list of supported languages"><OPTION value="en" selected>English</OPTION></SELECT></TD>

</TR>

<TR>

<TD valign="top" class="FieldText" colspan="3">

<BR>

</TD>

</TR>

<TR>

<TD valign="top" class="FieldText" colspan="3"></TD>

</TR>

</TABLE>

&lt;script type="text/javascript">

//this var's content is what replaces the buttons when you submit a form

//it can be an image, text, or nothing at all

var submittedFormIMG ="<IMG id=\"submitted\" src=\"images/load_animation.gif\" alt=\"\"/>";

</SCRIPT>

<DIV title="Show submit buttons when visible" style="margin-top:10px;" id="thebuttons">

<TABLE cellspacing="0" border="0" cellpadding="3" class="ActionBar">

<TR>

<TD class="ActionBar"><BUTTON onmouseout=";return displayStatusMsg('')" onmouseover=";return displayStatusMsg('')" type="button" value="_btn_submit1" class="ActionButton" name="submit1" id="submit1" onclick="java script:currentPage.validateForm='true';;this.form.oaaSelectedButton='submit1';trySubmit('e_login_main_process.do','true','','e_login_main_start','submit1',null,'top=20,left=20,alwaysRaised=1,scrollbars=0,width=550,height=550','post'); void(0);" title="Click this button to log in.">Login</BUTTON></TD>

</TR>

</TABLE>

</DIV>

</FORM>

</BODY>

Any suggestions on what I'm doing wrong?

Thanks!

Jim

Share this post


Link to post
Share on other sites



Woot - NM, I found what I was looking for in another thread. As often as I hear "Search," I still don't ever perform an adequate job of it.

Thanks a ton!

Jim

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0