51Testing软件测试论坛

标题: QTP关闭所有浏览器 [打印本页]

作者: wyrf584    时间: 2010-8-19 09:30
标题: QTP关闭所有浏览器
各位大大,有一个小问题请问下哈~~
我想关闭所有已打开的浏览器,使用以下方法:
1.SystemUtil.CloseProcessByName("iexplore.exe")
2.用循环判断Browser("index:=0").Exist(0)
第一种方法会判断很久,第二种方法当判断到最后一个的时候总是要好几秒
请问有没有更快的办法呀
作者: skyzhu    时间: 2010-8-19 10:47
标题: 属性自己改一下
Set ie = Description.Create()
ie("version").value  = "internet explorer 6"
For i = 0 to desktop.ChildObjects(ie).count - 1
        desktop.ChildObjects(ie).item(0).close
Next
作者: zzxxbb112    时间: 2010-8-19 12:00
也可以使用WMI
作者: feiyunkai    时间: 2010-8-19 13:49
标题: 关闭所有IE浏览器
set WMI=getobject("winmgmts:")
set iexplore=WMI.execquery("select * from win32_process where name='iexplore.EXE'") '查找iexplore.EXE进程
for each pro in iexplore                                                                  
pro.terminate                                                                           '结束所有iexplore.EXE进程
next
作者: lvguobin    时间: 2010-8-19 15:51
Kill就行了。
作者: yahuu    时间: 2010-8-20 09:17
执行bat语句 taskkill /IM iexplore.exe /F /T
一步搞定




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2