打开浏览器,转到网站并登录批处理脚本

时间:2017-05-22 07:25:43

标签: vbscript

我想制作一个批处理脚本,用于在Windows 10上使用ie,chrome或firefox自动登录到网站。

我已经有了一个代码,但它没有正常工作:在我双击文件后,我必须在浏览器启动后手动点击浏览器窗口,并且有一些问题,我不知道如何定时解决。

希望我能在你的帮助下找到解决方案。

My code:
Const strURL = "https://www.raise.com/user/sign_in"
Const strID = "testinsl@gmail.com"
Const strPswd = "1q2w3e4r5t!"

Set objIE = CreateObject( "InternetExplorer.Application" )
objIE.Visible = True
objIE.Navigate2 strURL

Do While objIE.Busy
    WScript.Sleep 1000
Loop

Set objShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 1000
objShell.SendKeys strID
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys strPswd
WScript.Sleep 100
objShell.SendKeys "{ENTER}"

1 个答案:

答案 0 :(得分:0)

尝试:

strURL = "https://www.raise.com/user/sign_in"
strID = "testinsl@gmail.com"
strPswd = "1q2w3e4r5t!"

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

Do
    WScript.Sleep 250
Loop While oIE.Busy

oIE.Document.All.Item("Email_id").Value = strID
WScript.Sleep 100
oIE.Document.All.Item("password").Value = strPswd
WScript.Sleep 100
oIE.Document.All.Item("login").Click

Help = Link

相关问题