菜鸟求教,请高人指点QTP报错:“缺少对象: 'WScript'”
以下代码执行后报“缺少对象: 'WScript'” ,但把Set WshShell = WScript.CreateObject ("WScript.Shell")改成Set WshShell = CreateObject ("WScript.Shell")是可以的,后面的WScript.sleep 1500又是缺少对象WScript
Dim WshShell
Set WshShell = WScript.CreateObject ("WScript.Shell")
WshShell.Run "notepad"
WScript.sleep 1500
WshShell.AppActivate "无标题 - 记事本"
WshShell.sendKeys "H"
WScript.sleep 500
WshShell.sendKeys "A"
WScript.sleep 500
WshShell.sendKeys "P"
WScript.sleep 500
WshShell.sendKeys "P"
WScript.sleep 500
WshShell.sendKeys "Y"
WScript.sleep 500
WshShell.sendKeys "%FS"
WshShell.sendKeys "t"
WScript.sleep 500
WshShell.sendKeys "e"
WScript.sleep 500
WshShell.sendKeys "s"
WScript.sleep 500
WshShell.sendKeys "t"
WScript.sleep 500
WshShell.sendKeys "{.}"
WScript.sleep 500
WshShell.sendKeys "t"
WScript.sleep 500
WshShell.sendKeys "x"
WScript.sleep 500
WshShell.sendKeys "t"
已解决 xunying 发表于 2015-1-15 10:22
已解决
LZ能否分享下你的解决方案。 把Set WshShell = WScript.CreateObject ("WScript.Shell")改成Set WshShell = CreateObject ("WScript.Shell")
把WScript.sleep改成wait了 高手,学习了 1、是不是没有声明WScript.
QTP不支持WScript.CreateObject 同样的问题
页:
[1]