admin 管理员组文章数量: 887021
新建脚本test.vbs
1.打开谷歌浏览器
Dim wsh
Set wsh = CreateObject("wscript.shell")
set wshshell=CreateObject("wscript.shell")
wshshell.Run"chrome.exe http://localhost:9527/#/login" '如果浏览器打不开添加绝对路径,后面添加访问的路径
wsh.AppActivate " " ' 引号中填浏览器最上面的标题
WScript.Sleep 1000*8
wsh.SendKeys "admin" '引号中填帐号
WScript.Sleep 1000*4
wsh.SendKeys "{ENTER}"
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*5
wsh.SendKeys "abcd_1234" '引号中填密码
WScript.Sleep 1000*3
wsh.SendKeys "{ENTER}"
Set objShell = CreateObject("Wscript.Shell")
objShell.SendKeys "{F11}"
2.打开ie浏览器
Dim wsh,ie
Set wsh = CreateObject("wscript.shell")
Set ie = WScript.CreateObject("InternetExplorer.Application")
URL=" http://www.baidu"
ie.visible = True
ie.navigate URL
WScript.Sleep 1000*5
wsh.AppActivate " " ' 引号中填浏览器最上面的标题
WScript.Sleep 1000*1
wsh.SendKeys "帐号" '引号中填帐号
WScript.Sleep 1000*1
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "密码" '引号中填密码
WScript.Sleep 1000*1
wsh.SendKeys "{ENTER}"
Set objShell = CreateObject("Wscript.Shell")
objShell.SendKeys "{F11}"
3.模拟清除缓存登录
Dim wsh
Set wsh = CreateObject("wscript.shell")
set wshshell=CreateObject("wscript.shell")
Url="http://localhost:9527/#/login"
wshshell.Run"""C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe""" & Url
WScript.Sleep 1000*3
wsh.SendKeys "^+{Delete}"
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "{ENTER}"
WScript.Sleep 1000*3
wshshell.Run"""C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe""" & Url
WScript.Sleep 1000*4
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "{ENTER}"
Set objShell = CreateObject("Wscript.Shell")
objShell.SendKeys "{F11}"
特殊功能键
Shift---------WshShell.SendKeys “+” 常用于转换中英文
Ctrl---------WshShell.SendKeys “^”
Alt---------WshShell.SendKeys “%”
要发送加号“+”,可使用WshShell.SendKeys “{+}”
Space---------WshShell.SendKeys " "
Enter---------WshShell.SendKeys “{ENTER}”
←---------WshShell.SendKeys “{RIGHT}”
↑---------WshShell.SendKeys “{UP}”
F1---------WshShell.SendKeys “{F1}”
BACKSPACE {BACKSPACE}, {BS}, 或 {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or Delete {Delete} 或 {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER}或 ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or Insert {Insert} 或 {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
版权声明:本文标题:vbs 打开指定浏览器网页 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1715783236h651119.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论