'SystemUtil对象的方法用法
SystemUtil.Run "Notepad.exe"
wait 1
'关闭由QuickTest打开的所有进程
'msgbox SystemUtil.CloseDescendentProcesses
SystemUtil.CloseDescendentProcesses
'根据敞开的句柄找到相应的进程,并关闭该进程
hwnd = Window("Notepad").GetROProperty("hwnd")
SystemUtil.CloseProcessByHwnd(hwnd)
'根据进程PID关闭进程
PID = Window("Notepad").GetROProperty("process id")
SystemUtil.CloseProcessById(PID)
'根据进程名称关闭进程
'msgbox SystemUtil.CloseProcessByName("Notepad.exe")
SystemUtil.CloseProcessByName("Notepad.exe")
'根据窗口标题关闭进程
SystemUtil.CloseProcessByWndTitle("Untitled - Notepad")
'wait 5时光标可以移动,解除禁止
SystemUtil.BlockInput
Browser("百度一下,你就知道").Page("163网易免费邮箱").WebEdit("WebEdit").Set "qtp_test00"
wait 3
Browser("百度一下,你就知道").Page("163网易免费邮箱").WebEdit("password").SetSecure "4fcf338be2c65c451d5febbbb214acd42e380e48c0ab8d9c04e826f8"
Browser("百度一下,你就知道").Page("163网易免费邮箱").WebButton("登 录").Click
SystemUtil.UnblockInput
wait 5
SystemUtil.Run "Notepad.exe"
wait 1
'关闭由QuickTest打开的所有进程
'msgbox SystemUtil.CloseDescendentProcesses
SystemUtil.CloseDescendentProcesses
'根据敞开的句柄找到相应的进程,并关闭该进程
hwnd = Window("Notepad").GetROProperty("hwnd")
SystemUtil.CloseProcessByHwnd(hwnd)
'根据进程PID关闭进程
PID = Window("Notepad").GetROProperty("process id")
SystemUtil.CloseProcessById(PID)
'根据进程名称关闭进程
'msgbox SystemUtil.CloseProcessByName("Notepad.exe")
SystemUtil.CloseProcessByName("Notepad.exe")
'根据窗口标题关闭进程
SystemUtil.CloseProcessByWndTitle("Untitled - Notepad")
'wait 5时光标可以移动,解除禁止
SystemUtil.BlockInput
Browser("百度一下,你就知道").Page("163网易免费邮箱").WebEdit("WebEdit").Set "qtp_test00"
wait 3
Browser("百度一下,你就知道").Page("163网易免费邮箱").WebEdit("password").SetSecure "4fcf338be2c65c451d5febbbb214acd42e380e48c0ab8d9c04e826f8"
Browser("百度一下,你就知道").Page("163网易免费邮箱").WebButton("登 录").Click
SystemUtil.UnblockInput
wait 5
本文详细介绍了SystemUtil对象的各种方法,包括如何通过不同方式关闭进程,如按PID、名称、窗口标题等。此外还介绍了如何控制输入以避免干扰自动化测试过程。
873

被折叠的 条评论
为什么被折叠?



