我正在尝试使用以下VB脚本自动执行应用程序登录。我成功登录网页,但之后我需要点击网页上的按钮。
代码:
Const strURL = "xxx"
Const strID = "yyy"
Const strPswd = "zzz"
Set IE = CreateObject( "InternetExplorer.Application" )
IE.Visible = True
IE.Navigate strURL
Set objShell = CreateObject("WScript.Shell")
WScript.Sleep 1000
objShell.SendKeys strID
objShell.SendKeys "{TAB}"
objShell.SendKeys strPswd
objShell.SendKeys "{ENTER}"
IE.getElementsByname("Button Name").Click
但我收到的错误如"The object invoked has disconnected from its client".
code80010108 source :Null
答案 0 :(得分:0)
I Resolved the issue with below changes in code.
Option Explicit
Dim IE,objShell
set IE = CreateObject("InternetExplorer.Application")
Set objShell = CreateObject("WScript.Shell")
WScript.Sleep 6000
IE.Visible = True
IE.Navigate "URL"
Do While IE.Busy
Loop
IE.Document.getElementByID("sign_up").Click
WScript.Sleep 1000
Const strID = "email"
Const strPswd = "pwd"
Const loginname = "xxx"
WScript.Sleep 2000
objShell.SendKeys loginname
WScript.Sleep 3000
objShell.SendKeys "{TAB}"
WScript.Sleep 1000
objShell.SendKeys strID
WScript.Sleep 3000
objShell.SendKeys "{TAB}"
WScript.Sleep 1000
objShell.SendKeys strPswd
WScript.Sleep 2000
objShell.SendKeys "{ENTER}"