I need to fill the login form by VBA code. I could not get any reaction on any combination of ".Click" method so i've tried to fill the form and then call JS submitting function but always get this error (as a VBA Error Message Box):
Could not complete the operation due to error 80020101
On the .jsp page there are following elements to interact with:
The form itself:
<form id="LoginViewForm" onsubmit="checkOnSubmit(this); return false;"
method="POST" name="LoginViewForm" action="LoginViewController.jsp">
<input type="HIDDEN" name="ControllerAction">
<input type="HIDDEN" name="loginPassword">
<input type="HIDDEN" name="newPassword">
Input boxes are the following:
<td>
<input name="loginUser" size="20" maxlength="18" type="text"
tabindex="1" class="inputField" onfocus="this.select();">
</td>
<td>
<input name="dspLoginPassword" size="20" maxlength="18"
type="password" tabindex="2" class="inputField"
onfocus="this.select();" autocomplete="off">
</td>
There is a button, which should be clicked to submit a form:
<table id="buttonID1" border="1" cellspacing="0" cellpadding="0"
class="buttonBorderEmphasized">
<tbody><tr>
<td id="buttonEmphasized" nowrap="yes"class="buttonTextEmphasized">
<a href="javascript:submitLogin (document.LoginViewForm);"
tabindex="3">
Login </a>
</td></tr></tbody></table>
And there is following script function, which is started by the button above:
function submitLogin(form)
{
if(validateLogin()) {
window.document.body.style.cursor = 'progress';
showStatusMessage();
form.ControllerAction.value = 'Login';
form.submit();
return;
} else resetSubmitted(); return;
}
I'm trying following code to handle with it (have tried different variants of calling java script, this is final one, but still doesn't work):
Set objFormMain = IEDoc.Frames("i2ui_shell_content").Document _
.Frames("results").Document.forms("LoginViewForm")
With objFormMain
.Elements("LoginUser").Value = 1
.Elements("dspLoginPassword").Value = 1
IE.Document.all.Item
Call IE.Document.parentWindow.execScript("submitLogin(document.LoginViewForm)", "JavaScript")
.submit
End With
The error itself returns at line "Call IE.Document.parentWindow.execScript("submitLogin(document.LoginViewForm)", "JavaScript")"
Any ideas how to modify the code to make it work?