我需要用VBA代码填写登录表单。我无法对“
.Click”方法的任何组合产生任何反应,因此我尝试填写表格,然后调用JS提交功能,但始终收到此错误(作为VBA错误消息框):
由于错误80020101而无法完成操作
在.jsp页面上,有以下元素可以与之交互:
表格本身:
method="POST" name="LoginViewForm" action="LoginViewController.jsp">
输入框如下:
tabindex="1" class="inputField" onfocus="this.select();">
type="password" tabindex="2" class="inputField"
onfocus="this.select();" autocomplete="off">
有一个按钮,应单击以提交表单:
class="buttonBorderEmphasized">
tabindex="3">
Login
还有以下脚本功能,由上面的按钮启动:
function submitLogin(form)
{
if(validateLogin()) {
window.document.body.style.cursor = 'progress';
showStatusMessage();
form.ControllerAction.value = 'Login';
form.submit();
return;
} else resetSubmitted(); return;
}
我正在尝试按照以下代码进行处理(尝试了各种不同的调用Java脚本的变体,这是最后一个,但仍然无法正常工作):
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
错误本身在“调用IE.Document.parentWindow.execScript(“
submitLogin(document.LoginViewForm)”,“ JavaScript”)“行返回
有什么想法如何修改代码以使其工作?
这篇博客讲述了作者尝试通过VBA代码填写并提交一个JSP网页上的登录表单遇到的问题。作者在VBA中使用IEDoc对象尝试与页面元素交互,但在调用JavaScript的submitLogin函数来提交表单时遇到了80020101错误。博客内容包括表单的HTML结构,VBA代码示例以及作者寻求解决该问题的思路。

1万+

被折叠的 条评论
为什么被折叠?



