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