Will workndows script host run script in Chrome browser

 ̄綄美尐妖づ 提交于 2019-12-13 02:48:40

问题


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

  1. tab to password text box then hit the

  2. enter key and log in

来源:https://stackoverflow.com/questions/56174522/will-workndows-script-host-run-script-in-chrome-browser

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!