1

这段代码让我进入页面并填写用户 ID 和密码字段,但在提交之后,我从应用程序收到用户 ID 和密码无效的响应。如果我不执行提交命令,而是让程序停在页面上然后手动单击登录按钮,那么我成功登录。即使在表单上正确填写了 userid 和 paasword,它们似乎也没有正确传递到下一页。

有什么想法吗?我是一个 VBsript 新手。

Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "https://cpprod.stjohns.edu/cp/home/displaylogin"
Do
    WScript.Sleep 500
loop While IE.ReadyState < 4 And IE.Busy 
IE.Document.getElementByID("user").value = "testacct"
WScript.Echo IE.Document.getElementByID("user").value
IE.Document.getElementByID("pass").value = "testpw"
WScript.Echo IE.Document.getElementByID("pass").value
IE.Document.getElementByID("cplogin").submit
4

1 回答 1

1

试试下面的,让我知道你的结果......

Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oIE.navigate WebPath

Do
    WScript.Sleep 250
Loop While oIE.ReadyState < 4 And oIE.Busy

oIE.Document.All.Item("username").Value = sUser
WScript.Sleep 250
oIE.Document.All.Item("password").Value = sPass
WScript.Sleep 250
oIE.Document.All.Item("login").Click
于 2013-10-28T18:37:46.040 回答