问题
Dim Wsh
Set objShell =CreateObject("WScript.Shell")
Set objExec = objShell.Exec("C:\Program Files\Google\Chrome\Application\chrome.exe https://<internal company VPN address>")
Wscript.Sleep 1000
objShell.AppActivate("<Title page>")
Wscript.Sleep 1000
Wsh.SendKeys "<username>"
Wscript.Sleep 1000
Wsh.SendKeys "{TAB}"
Wsh.Sendkeys "<password>"
Wscript.Sleep 1000
Wsh.SendKeys "{ENTER}"
I am getting a WSH "objectRequired ." runtime error on trying to run the following script.
What happens is :
Chrome Browser opens up correctly to Chrome and the included https address ( internal vpn address )
However it stops with the stated runtime error just prior to the because the cursor is not focused in that text box.
My understanding is that WSH cannot treat Chrome browser and an object and that java script would work however I need advice or starte code to help me along.
Objective is to
1 . set focus on the username text box then
tab to password text box then hit the
enter key and log in
来源:https://stackoverflow.com/questions/56174522/will-workndows-script-host-run-script-in-chrome-browser